Backtracking
102 / 170BacktrackingLesson 9 of 10About 58 min
The unit's hardest problem, and it is the multi-set bookkeeping from Unit 1 with an undo step.
Two cells share a falling diagonal when their row minus column is equal, and a rising diagonal when their row plus column is equal. Type the three lines it prints.
cells = [(0, 0), (1, 1), (2, 0), (1, 3)] print("row - col:", [r - c for r, c in cells])print("row + col:", [r + c for r, c in cells])print("(0,0) and (1,1) share a diagonal:", (0 - 0 == 1 - 1) or (0 + 0 == 1 + 1))Read the constraints first and let them tell you what complexity is expected. Derive the approach, implement it, run the tests, and submit when it passes.