Open fadhilahade opened 5 years ago
while (true) {
let mountainHighest = 0;
let mountainToShot = 0;
for (let i = 0; i < 8; i++) {
const mountainH = parseInt(readline()); // represents the height of one mountain.
if(mountainHighest < mountainH){
mountainHighest = mountainH
mountainToShot = i}
}
// Write an action using console.log()
// To debug: console.error('Debug messages...');
console.log(mountainToShot); // The index of the mountain to fire on.
}
https://www.codingame.com/ide/puzzle/the-descent