Time Map with Sum and Average
Updated
Problem statement
Process operations on a time-indexed integer store. A set appends one value for a key at its timestamp. A query considers all values for that key whose stored timestamp is at most the query timestamp.
get: latest eligible value, or the empty string.sum: sum of eligible values, using0when none exist.average: exact reduced fractionnumerator/denominator, or the empty string when none exist.
Each set returns null. Return one string result per operation.
Function
runTimeMapAggregates(operations: String[], keys: String[], values: int[], timestamps: int[]) → String[]Examples
Example 1
operations = ["set","get","sum","average"]keys = ["a","a","a","a"]values = [4,0,0,0]timestamps = [1,1,1,1]return = ["null","4","4","4/1"]The query uses exactly the stored prefix whose timestamps do not exceed its timestamp.
Example 2
operations = ["get","sum","average"]keys = ["x","x","x"]values = [0,0,0]timestamps = [5,5,5]return = ["","0",""]The query uses exactly the stored prefix whose timestamps do not exceed its timestamp.
Example 3
operations = ["set","set","get","sum","average"]keys = ["a","a","a","a","a"]values = [2,4,0,0,0]timestamps = [1,3,2,3,3]return = ["null","null","2","6","3/1"]The query uses exactly the stored prefix whose timestamps do not exceed its timestamp.
Constraints
1 <= operations.length <= 100000, and all input arrays have equal length.- Operations are
set,get,sum, oraverage. - For each key, set timestamps are strictly increasing.
-10^6 <= values[i] <= 10^6; aggregate sums fit signed 64-bit range.
Source note: Exact author-written prompt evidence retained from the latest verified source sighting.
More Confluent Phone Screen questions
- Implement tail -nPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Sudoku Board ValidationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Sudoku Puzzle SolverPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Match a Variadic Function SignaturePHONE SCREEN · Seen Oct 2026
- Sequential Phrase Search Across DocumentsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Time-Based Key-Value Store with Range AggregatesPHONE SCREEN · Seen Sep 2026
- Word Search Across DocumentsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Windowed Key-Value MapPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2025
- Least-Strong Common DefeaterPHONE SCREEN · Seen Oct 2022
- Wildcard Matching with StarsPHONE SCREEN · Seen Mar 2021
Similar questions at other companies
- Out-of-Order Logger Rate LimiterGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Consistent-Hash Packet RouterAmazon · PHONE SCREEN
- Snapshot Map with Sparse Version HistorySnorkel AI · PHONE SCREEN
- Maintain a Consistent-Hashing RingApple · PHONE SCREENApple interview questions
- Time-Based Key-Value StoreOracle · PHONE SCREEN · ONSITE INTERVIEWOracle interview questions
- Time-Based Key-Value StoreCockroach Labs · PHONE SCREEN · ONSITE INTERVIEW
- Structured Log Stream with QueriesOpenAI · PHONE SCREENOpenAI interview questions
- Time-Based Key-Value StoreVerkada · PHONE SCREENVerkada interview questions
- Interview Slot BookingTrueFoundry · PHONE SCREEN
- Time-Based Key-Value Map With Floor and Ceiling QueriesCharacter.AI · PHONE SCREEN
Confluent interview experiences
- Confluent Older Concurrency Rounds: 12 Experiences (Part 2 of 2)
- Confluent Concurrency Interviews: 28 Experiences (Part 1 of 2)
- Confluent SWE OA, Coding and Design Interviews: 19 Experiences
- Confluent File Manipulation Round (tail -n): 19 Experiences
- Confluent Coding and System Design Questions: 33 Questions