TweakCode
Graphs lessons
Loading editor…
Test casesRun to compare output
Input
heights = [[1,2,2,3,5],[3,2,3,4,4],[2,4,5,3,1],[6,7,1,4,5],[5,1,1,2,4]]
Output
—
Expected
[[0,4],[1,3],[1,4],[2,2],[3,0],[3,1],[4,0]]

More practice

Same technique, different problems. Try them without the walkthrough.