Algorithms
Algorithms copied to clipboard
Add 2 variations of solution2(), with space complexity = O(n/2) and O(1) respectively.
trafficstars
solution2a(), only create an array half the size ofsolution2(), since all odd indices have value 0.solution2b(), only create 3 variables, since to calculate column n, only need to remember state of column n-2 and n-4.