It's time to select the fastest reindeer for Santa's journeys! 🦌🎄
Santa Claus has organized exciting reindeer races to determine which ones are in the best shape.
Your task is to display each reindeer's progress on a snow track in isometric format.
The information you receive:
indices
: An array of integers representing each reindeer's progress on the track:0
: The lane is empty.length
: The length of each lane.Return a string representing the race track:
length
positions filled with snow (~
).r
./1
, /2
, etc.Examples:
drawRace([0, 5, -3], 10)
/*
~~~~~~~~~~ /1
~~~~~r~~~~ /2
~~~~~~~r~~ /3
*/
drawRace([2, -1, 0, 5], 8)
/*
~~r~~~~~ /1
~~~~~~~r /2
~~~~~~~~ /3
~~~~~r~~ /4
*/
drawRace([3, 7, -2], 12)
/*
~~~r~~~~~~~~ /1
~~~~~~~r~~~~ /2
~~~~~~~~~~r~ /3
*/