O(n) + O(n - k) can be simplified as the larger of the two terms, since adding them does not change their order of growth so shouldn’t O(n) + O(n - k) = O(n)?
Course: Grokking Coding Interview Patterns in Java - Learn Interactively
Lesson: Solution: Repeated DNA Sequences - Grokking Coding Interview Patterns in Java