← Oracle Interview Insights

Oracle·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Oracle SWE interview with a log-parsing problem that looked manageable on the surface but had enough edge cases to keep you on your toes. Fairly standard technical phone screen energy.

Questions Asked (1)

Q1

Given a list of unsorted log entries each containing a user ID, an action (signin or signout), and a timestamp, plus an integer maxTime, find all user IDs that have at least one valid session. A session is valid if a signin is immediately followed by that user's next signout and the elapsed time is within maxTime.

Algorithms & Data Structures
Author's notes

My first instinct was to just sort everything globally and walk through it, which would've been a mess.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Sort the log entries by user ID and timestamp, then for each user, scan their entries in order to pair each signin with the next signout, checking if the time difference is within maxTime. Collect user IDs that have at least one valid session.

Pro tip: Clarify edge cases upfront, such as multiple signins before a signout or signout without signin, and state your assumptions to show thoroughness.

1. Clarify requirements and edge cases

Ask about input format, whether timestamps are in seconds or milliseconds, and how to handle invalid sequences like consecutive signins or signouts without signins.

2. Choose data structures and sorting strategy

Decide to sort entries by user ID and timestamp, or use a hash map to group entries by user ID and then sort each group. Consider time and space complexity.

3. Process sessions per user

For each user, iterate through sorted entries, tracking the last signin. When a signout is encountered, if there is a pending signin, compute the duration and check if it's within maxTime.

4. Collect and return valid user IDs

Maintain a set of user IDs that have at least one valid session, and return the set as the result.

5. Analyze complexity and test

State the time complexity (O(n log n) due to sorting) and space complexity (O(n)), and walk through a small example to verify correctness.

Key Points to Mention

  • Sorting by user ID and timestamp is crucial for correct pairing.
  • Use a hash map to group entries by user ID for efficient processing.
  • Handle edge cases: multiple signins before a signout, signout without signin, and sessions exceeding maxTime.
  • Time complexity: O(n log n) due to sorting; space complexity: O(n) for storing grouped entries.
  • Only the first valid session per user is needed to include the user ID in the result.
  • Consider using a set to avoid duplicate user IDs in the output.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.