Skip to content

Latest commit

 

History

History

16-challenge

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Challenge 16

Since the episode with him getting lost on Tuesday (Day 12), the elves have started to get concerned about Santa getting lost again, but deeper in the forest. Since Santa's college buddy got WiFi installed in the whole property, Santa just wanders around scrolling TikTok without looking where he's going. Santa claimed that the reason the whole campus needed WiFi (even the forest) was to "future-proof the business" and "attract top talent" but it's beginning to seem like it was so he could personally get better phone service (cell reception in the north pole isn't great and without 116th H.R.7302, neither is the rural internet speed).

Sure enough. It happened again. Santa got lost, again, but this time much deeper in the forest.

This time we have to search columns as well as rows to find him.

The FindSanta takes only one argument, the forest (an array of arrays), and returns the [Row, Column] indices where Santa is located. Then an elf search team can be deployed to retrieve him.

Expected Behavior

type Forest01 = [['🎅🏼', '🎄', '🎄', '🎄'], ['🎄', '🎄', '🎄', '🎄'], ['🎄', '🎄', '🎄', '🎄'], ['🎄', '🎄', '🎄', '🎄']]
type SantaIndex01 = FindSanta<Forest01>
// [0, 0]

type Forest02 = [['🎄', '🎄', '🎄', '🎄'], ['🎄', '🎄', '🎄', '🎄'], ['🎄', '🎄', '🎄', '🎄'], ['🎄', '🎅🏼', '🎄', '🎄']]
type SantaIndex02 = FindSanta<Forest02>
// [3, 1]

type Forest03 = [['🎄', '🎄', '🎄', '🎄'], ['🎄', '🎄', '🎄', '🎄'], ['🎄', '🎄', '🎅🏼', '🎄'], ['🎄', '🎄', '🎄', '🎄']]
type SantaIndex03 = FindSanta<Forest03>
// [2, 2]

type Forest04 = [['🎄', '🎄', '🎄', '🎄'], ['🎄', '🎄', '🎄', '🎄'], ['🎄', '🎅🏼', '🎄', '🎄'], ['🎄', '🎄', '🎄', '🎄']]
type SantaIndex04 = FindSanta<Forest04>
// [2, 1]

type Forest05 = [['🎄', '🎄', '🎄', '🎄'], ['🎄', '🎄', '🎅🏼', '🎄'], ['🎄', '🎄', '🎄', '🎄'], ['🎄', '🎄', '🎄', '🎄']]
type SantaIndex05 = FindSanta<Forest05>
// [1, 2]

Prompt by Dimitri Mitropoulos of MiTS.