Peak Concurrent Db2 Connections From Session Logs
Last updated: November 29, 2026
Quick Overview
Given session records as (connect_time, disconnect_time) pairs for a Db2 instance, return the maximum number of simultaneous connections and the earliest time that peak is reached.
IBM
November 29, 20260
0
0 solved
Given session records as (connect_time, disconnect_time) pairs for a Db2 instance, return the maximum number of simultaneous connections and the earliest time that peak is reached.
Capacity questions about Db2 connection pools are common in IBM Data and AI team screens. The interviewer checks that you turn intervals into events, sort them with a careful tie rule, and justify that rule from the domain.
What the Interviewer Expects
- Convert intervals into +1 and -1 events
- State and justify the tie-breaking rule at equal timestamps
- Return the time of the peak, not only its value
- Run in O(n log n)
- Mention the heap-based alternative
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you also report how long the peak lasted?
- If logs arrive as a stream, how do you maintain the current count?
- How would you find the minimum pool size if each connection must be served by a dedicated slot?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Each session is half-open [start, end): a client that disconnects at time 10 frees its slot before a client connecting at time 10 needs one. Return (peak, time) where time is the first moment th...
High-Level Design
Create an event (t, +1) for each connect and (t, -1) for each disconnect. Sort by time, and at equal times process -1 before +1, which is exactly the half-open rule. Sorting tuples where -1 is...