데일리 루틴
51번 - 푸드 파이트 대회
https://school.programmers.co.kr/learn/courses/30/lessons/134240
function solution(food) {
var answer = '';
const amount = [];
const foodPlace = [];
for(let i=1; i<food.length; i++){
if(food[i] % 2 === 0)
amount.push(food[i]/2);
else
amount.push((food[i] - 1) / 2);
}
for(let i=0; i<amount.length; i++){
for(let j=0; j<amount[i]; j++){
foodPlace.push(i + 1);
}
}
answer += foodPlace.join('');
answer += 0;
answer += foodPlace.reverse().join('');
return answer;
}