The solution states that the space complexity will be O(1); however, this is not the case since a string is created to store the result i.e., minSubsequence. Worst case, the space would be O(n) where ‘n’ is the string to search. The solution is also using inefficient string building with the += operator, this means the string is recreated every time a character is appended, causing O(n) time where ‘n’ is the string length. Leveraging a StringBuilder has O(1) append time.
Course: Grokking Coding Interview Patterns in Java - Learn Interactively
Lesson: Solution: Minimum Window Subsequence - Grokking Coding Interview Patterns in Java