Learn Python for free at Productive Dev:
courses.productivedev.com
Here I try a Medium Hackerrank algorithm problem called Queen's Attack II.
The first solution uses unnecessary space and results in an out of memory error. It turns out that O(n^2) space is a problem!
The second solution runs in O(k) time and O(1) space where k is the number of obstacles.