Daily Coding Challenge - Hidden Treasure

Tell us what’s happening:

Test case 3 is incorrect. The character found at [1,1] is “O”, which is to return “Recovered”. Can someone please fix this?

Your code so far

function dive(map, coordinates) {
  const char = map[coordinates[0]][coordinates[1]];
  console.log(char)
  return char === "-" ? "Empty" : char === "X" ? "Found" : "Recovered";
}

console.log(dive([[ "-", "X"], [ "-", "O"], [ "-", "O"]], [1, 1]))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36

Challenge Information:

Daily Coding Challenge - Hidden Treasure
https://www.freecodecamp.org/learn/daily-coding-challenge/2025-10-24

The test is correct, as [1, 1] is not the last piece of the treasure.

the logic to return the output is not based only if you are on an O or not, please look again at the difference between Found and Recovered, there is an other O, that means there is more treasure to find

1 Like

Thanks. I realized my understanding of the problem was incorrect.