Reported August 2026
IBMarray

Count Paginated Medical Records in a Range

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

The edge case that sinks a quick solution here is the empty page, and IBM's August 2026 OA report puts it right in the example. The task is to count medical record values across nested pages that fall inside an inclusive range. It's a plain array scan with no hidden algorithm. That's the trap: people relax, skip the boundaries, and lose points on the empties. If you have this OA in the next day or two, read the edge cases twice. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment, but this one is mostly about not rushing.

The problem

A medical-records API returns a paginated response. For this network-free practice version, pages[i] contains the integer values of the requested record field returned on API page i + 1.
A record qualifies when its field value lies in the inclusive interval from lowerBound through upperBound.
Return the total number of qualifying records across every page.

Function
countMedicalRecordsInRange(pages: int[][], lowerBound: int, upperBound: int) → int

Examples
Example 1
pages = [[110,125,120],[100,115],[]]
lowerBound = 110
upperBound = 120
return = 3
The qualifying values are 110, 120, and 115. Values 125 and 100 fall outside the inclusive interval, and the empty page contributes no records.

Constraints
pages and any of its rows may be empty.
Every field value, lowerBound, and upperBound fits in a signed 32-bit integer.
lowerBound ≤ upperBound.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The pattern is a nested array traversal with a counter. Loop over each page, loop over each value, and increment when lowerBound <= value <= upperBound. Both ends are inclusive, so use <= on both sides. Don't use < on the upper end. In Example 1, 110 and 120 both count, which is exactly where off-by-one bugs show up. Pages can be empty, and the outer pages array can be empty too, so don't index into pages[0] or assume a row has elements. Values fit in a signed 32-bit integer, so comparisons are safe, and a count can't overflow either unless the total number of records is enormous. Time is O(total records), space is O(1). Don't flatten into a new list, it's wasted memory. If you freeze on the OA, StealthCoder can hand you the clean double loop in seconds, but you can write this one yourself.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Count Paginated Medical Records in a Range 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. If you're reading this with an OA window open, you're who this was built for.

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. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Count Paginated Medical Records in a Range FAQ

How hard is the IBM medical records range count really?+

It's easy. It's a nested loop with a conditional counter. The difficulty is only in the details: inclusive bounds, empty pages, and an empty outer array. If you handle those three, you're done. Expect the hidden tests to focus on exactly those cases.

What's the trick to this problem?+

There isn't a clever one. The trick is not overthinking it. Iterate every page, iterate every value, and count when it satisfies lowerBound <= v <= upperBound. Don't sort or binary search, since that costs more and adds bug risk without improving the linear bound you need.

Which edge cases break a naive solution?+

Empty inner pages, an empty pages array, and values exactly equal to lowerBound or upperBound. Using strict less-than on either end drops valid records. Also avoid code that reads the first element of a page without checking that the page has any.

What's the time and space complexity I should state?+

Time is O(N) where N is the total number of values across all pages. Space is O(1) since you only keep a counter. Mention that flattening pages first would add O(N) space for no benefit, so you skip it.

How do I prepare for this in 48 hours?+

Write the double loop from memory in your language, then test it against three inputs: all empty pages, values equal to both bounds, and a single page. Spend the rest of your time on harder array and hash map problems, since this one is a warm-up.

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