Written Backwards
Return True if the list b is the list a written backwards, and False otherwise. Lists of different lengths never match, and two empty lists do.
It can be done without building a reversed list: let one position start at the front of a and another at the back of b, and compare the items as the two positions move.
Example 1
a [1,2,3]
b [3,2,1]
returns true
Read from the back, b gives 1, 2, 3, which is exactly a.
Example 2
a [1,2,3]
b [1,2,3]
returns false
b is the same as a, not its reverse: the first item of a is 1 but the last item of b is 3.
Example 3
a [1,2]
b [2,1,0]
returns false
The lengths differ.
Constraints
0 <= len(a), len(b) <= 210 <= a[i], b[i] <= 9
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.