The lesson says the provided solution has a space complexity of O(n). Since we exclude the output space from the space complexity, is the space comp due to initializing an array of length n at the start, which is considered auxiliary until the final results are input? If so, then could we reduce the space comp to O(1) by initializing an empty list and appending each addition?
Course: Grokking Coding Interview Patterns in Python - Learn Interactively
Lesson: https://www.educative.io/courses/grokking-coding-interview-patterns-python/solution-counting-bits