Reported March 2024
IBM

Table of Contents

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's March 2024 OA included a Table of Contents problem, and candidates are reporting it cold with no pattern hints. This is a parsing and indexing challenge disguised as a data structure question. You're building a lookup system from unstructured text. If you blank on the exact algorithm during the live OA, StealthCoder runs invisibly on your screen and feeds you the solution in real time. The trick is recognizing what data structure actually solves this faster than the obvious approach.

Pattern and pitfall

Table of Contents problems typically ask you to parse a hierarchical document structure, extract section metadata (titles, page numbers, nesting levels), and answer queries about relationships or positions. The common pitfall is hardcoding a solution for one specific format, then panicking when the input structure shifts slightly. You need a generic parser that builds a tree or hash table of sections indexed by level, title, or page number. The real problem isn't the parsing. It's understanding what the query expects: a list in insertion order, a sorted list, a hierarchical printout, or random-access lookup. Read the output format first. StealthCoder handles the edge case where your first attempt assumes the wrong indexing scheme and saves you the restart.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Table of Contents 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 for the candidate who got the OA invite this morning and has 72 hours, not six months.

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 for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Table of Contents FAQ

Is this just string splitting and storing results in a dictionary?+

Not quite. You need to detect hierarchy (indentation, numbering, or explicit level markers) and preserve parent-child relationships. A flat hash table fails queries like 'give me all subsections of chapter 3'. Think tree or graph of nodes, not a simple key-value store.

What if the input format isn't clearly defined in the problem statement?+

Infer from the examples. IBM often gives you one or two examples and expects you to reverse-engineer the rules. Look for patterns in spacing, numbering, or metadata. If it's ambiguous, code defensively: handle multiple formats or ask in a comment.

How much time should I spend parsing before jumping to queries?+

Parse in 5-7 minutes. Build your data structure, then test it against one example query. If your query logic fails, the issue is almost always in your parse tree, not the lookup. Don't over-optimize parsing. Get it working first.

Is recursion expected, or is iteration fine?+

Both work. Iteration is simpler for single-pass parsing with a stack to track nesting. Recursion is cleaner if you're re-traversing the tree for multiple queries. Pick whichever you can code faster and less error-prone.

What's the most common way this problem fails on first submission?+

Hardcoding assumptions about hierarchy depth or assuming all queries are list operations. When you hit a query like 'depth of section X' or 'parent of Y', a flat structure crumbles. Build the tree first. The queries will make sense after.

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