FastPrepTop Error Types in a Time Window
Problems/Top Error Types in a Time Window

Top Error Types in a Time Window

Notion logoNotion● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: An onsite report describes JSON responses with timestamps. It asks for the top error types in a chosen interval, and it pays attention to the interval boundaries. We chose a half-open interval and a lexicographic tie-break, since the report leaves out the boundary and ordering rules.

Our version is about 94% the same as the reported question.

Each response row is [timestamp, errorType], where timestamp is a decimal integer string. Count errors in the half-open interval [startTime, endTime).

Return at most k rows formatted as errorType|count. Rank larger counts first and break equal-count ties by lexicographically smaller error type. If fewer than k error types occur in the interval, return all of them.

Function

topErrorTypes(responses: String[][], startTime: long, endTime: long, k: int) → String[]

Examples

Example 1

responses = [["100","timeout"],["105","validation"],["108","timeout"],["110","auth"],["112","validation"],["115","timeout"]]startTime = 105endTime = 115k = 2return = ["validation|2","auth|1"]

The left boundary is included and the right boundary is excluded. Validation occurs twice; auth and timeout tie once, so auth wins lexicographically.

Constraints

  • 0 <= responses.length <= 200000.
  • 0 <= timestamp, startTime, endTime <= 10^18 and startTime < endTime.
  • 1 <= k <= 100000.
  • Error types are non-empty printable ASCII strings containing neither | nor a newline.

More Notion interview questions

  • Nested Todo ListPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • DAG Downstream NodesONSITE INTERVIEW · Seen Apr 2026
  • Mutable Table AggregationsPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2026
  • Page Permission InheritancePHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2026
  • Text Document HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2026
  • Sliding Window MedianONSITE INTERVIEW · Seen Oct 2025
  • Task Row ModificationsONSITE INTERVIEW · Seen Oct 2025
  • JSON Block Tree OperationsONSITE INTERVIEW · Seen Jul 2025
  • Block Type with the Most ChildrenPHONE SCREEN · Seen Mar 2026
  • Country with the Most EventsPHONE SCREEN · Seen Mar 2026

Similar questions at other companies

  • Unique Active Pins by Time SegmentPinterest · ONSITE INTERVIEWPinterest interview questions
  • Peak Process MemoryNutanix · ONSITE INTERVIEWNutanix interview questions
  • Calendar Event System with Pagination and IntersectionLead Bank · ONSITE INTERVIEWLead Bank interview questions
  • Highlight and Rank Overlapping CitationsHarvey · PHONE SCREEN · ONSITE INTERVIEWHarvey interview questions
  • Worker Management with Promotions and Double-Paid TimeInstacart · ONSITE INTERVIEWInstacart interview questions
  • Merchant Capacity Interval MergeDoorDash · PHONE SCREENDoorDash interview questions
  • Free Time for Every Meeting RoomScale AI · PHONE SCREENScale AI interview questions
  • Merge Collinear Point SegmentsApplied Intuition · PHONE SCREENApplied Intuition interview questions
  • Worker Management (Promotion Track), Part 4: Full-Shift Double PayAirbnb · OAAirbnb interview questions
  • Lab and Consultation Appointment MatchingAssort Health · PHONE SCREENAssort Health interview questions

Notion interview experiences

  • Notion Interviews, Level Not Reported: 20 Experiences
  • Notion Experienced SWE Interviews: 7 Experiences
  • Notion SWE New Grad Interviews: 3 Experiences
  • Notion SWE Intern Interviews and Debugging Round: 6 Experiences
  • Notion New Grad SWE Onsite Invitations: 2 Experiences
All Notion interview questionsSee Notion hiring insights
Saved
class Solution {
    public String[] topErrorTypes(String[][] responses, long startTime, long endTime, int k) {
        // Write your code here.
    }
}
Checking account…