You learned adjacent comparison. Check consecutive elements by looping to and accessing arr[i] and arr[i+1]. This pattern appears in finding duplicates, checking sorted sequences, counting runs.
You also saw how to transform a removal problem into a counting problem. Instead of simulating removals, you counted violations. This abstraction simplifies the code and improves performance.
The boundary awareness matters. Off-by-one errors are common when accessing array elements. Always ask: what's the last valid index I can safely access given my current operation?