Reported September 2026
IBMsliding window

Count Strictly Increasing Contiguous Windows

Reported by candidates from IBM's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live IBM OA. Under 2s to a working solution.
Founder's read

IBM reported this one in September 2026, and the input size is the first thing to read. With up to 10^5 points, checking every window of k points one by one can blow up when k is large. It looks like a sliding window problem, but it's really a single pass over the array. You count windows of exactly k points where every neighbor pair rises. If you've got an OA invite, expect this shape. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment, but the idea is simple enough to own before then.

The problem

The integer array yCoordinates gives the y-coordinate at each consecutive integer x-coordinate. Count contiguous windows of exactly k points whose y-coordinates are strictly increasing from left to right.
For this exercise, assume overlapping windows count separately. A window beginning at start is valid when yCoordinates[i] < yCoordinates[i + 1] for every index from start through start + k - 2.

Function
countIncreasingWindows(yCoordinates: int[], k: int) → int

Examples
Example 1
yCoordinates = [6,5,7,8,3,5,6]
k = 3
return = 2
The valid windows are [5,7,8] and [3,5,6].
Example 2
yCoordinates = [1,2,3,4]
k = 3
return = 2
Both overlapping windows [1,2,3] and [2,3,4] are valid.
Example 3
yCoordinates = [4,4,5]
k = 2
return = 1
Equality is not increasing, so only [4,5] counts.

Constraints
1 <= yCoordinates.length <= 10^5.
1 <= k <= yCoordinates.length.
1 <= yCoordinates[i] <= 10^9.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is to stop re-checking each window. Walk the array once and track the length of the current strictly increasing run, counted in points. If y[i] > y[i-1], run increases by one. Otherwise reset run to 1. Whenever run >= k, add one to the answer, because a window ending at i is valid. That handles overlapping windows automatically, which matches Example 2 where [1,2,3,4] with k=3 gives 2. The common pitfall is the equality case. Use strict greater-than, so [4,4,5] resets at the repeat. Another pitfall is the k=1 case. Every single point is a valid window, and the run logic already returns the array length. Brute force is O(n*k) and can hit around 10^10 operations. The run counter is O(n) time and O(1) space. If you freeze during the live OA, StealthCoder can hand you this loop as a hedge.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Count Strictly Increasing Contiguous Windows cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass IBM's OA.

IBM reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Count Strictly Increasing Contiguous Windows FAQ

How hard is this IBM OA question really?+

Easy to medium. The logic is one loop and one counter. The difficulty is spotting that you don't need to recheck each window. If you've done any run-length or consecutive-streak problem, this is the same move with a threshold of k.

What's the trick to avoid brute force?+

Keep a running count of the current strictly increasing streak. Reset it to 1 when a pair isn't increasing. Each time the streak reaches k or more, add one to the answer. That's O(n) instead of O(n*k).

Do overlapping windows count separately?+

Yes. The problem says so directly. In [1,2,3,4] with k=3 the answer is 2 because [1,2,3] and [2,3,4] both count. The streak method handles this because every index with streak >= k ends one valid window.

What edge cases should I test before submitting?+

Test k=1, where every point counts so the answer is the array length. Test repeated values like [4,4,5], where equality must reset the streak. Test a fully decreasing array, which should return 0 for k>=2. Also test k equal to the array length.

How do I prepare for this in 48 hours?+

Write the streak loop from memory twice. Then run the three given examples by hand. Spend the rest of your time on related array scans, like longest increasing subarray. The pattern repeats often in assessments, and the code is under ten lines.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with IBM.

OA at IBM?
Invisible during screen share
Get it