Reported September 2026
Together AIhash table

Time-Indexed Key-Value Store

Reported by candidates from Together AI's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Together AI OA. Under 2s to a working solution.
Founder's read

The mistake that sinks a first attempt on this Together AI question is assuming timestamps arrive in sorted order. They don't. Together AI candidates reported this time-indexed key-value store in September 2026, and the trap is baked into the second example: a SET at 10 followed by a SET at 2. If you append to a list and binary search it, you'll return wrong answers. The pattern is a hash table of key to ordered timestamps, plus a floor lookup. It's a clean problem if you spot the ordering catch early. If you blank mid-OA, StealthCoder runs invisibly as a safety net and hands you the structure.

The problem

Process a finite sequence of operations on an initially empty time-indexed key-value store.
["SET", key, timestamp, value] stores value for key at the non-negative integer timestamp. Setting the same key and timestamp again replaces the previous value.
["GET", key, timestamp] returns the value stored for that key at the greatest timestamp less than or equal to the query timestamp. Return the empty string when no such value exists.
Operations arrive in the given order, but timestamps are not necessarily ordered. Return the results of the GET operations in encounter order; SET operations produce no output.

Function
timeMap(operations: String[][]) → String[]

Examples
Example 1
operations = [["SET","model","4","v1"],["SET","model","9","v2"],["GET","model","7"],["GET","model","9"]]
return = ["v1","v2"]
The first query uses timestamp 4; the second can use the exact timestamp 9.
Example 2
operations = [["SET","k","10","late"],["SET","k","2","early"],["GET","k","5"],["GET","missing","99"]]
return = ["early",""]
Out-of-order timestamps are indexed normally, and an unknown key returns the empty string.
Example 3
operations = [["SET","a","3","old"],["SET","a","3","new"],["GET","a","3"]]
return = ["new"]
The later write replaces the value at the same key and timestamp.

Constraints
1 <= operations.length <= 10^4.
Each row is a valid SET or GET operation in the format above.
Keys and values contain 1 to 30 printable ASCII characters and do not contain the empty string.
0 <= timestamp <= 10^9.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The core is a hash map from key to a per-key store of timestamp and value pairs. GET needs the greatest timestamp less than or equal to the query, which is a floor search. The classic LeetCode version guarantees increasing timestamps, so you can append and binary search. Here you can't. Either keep each key's timestamps sorted on insert, using bisect and insert, or collect everything and sort lazily before the first GET after a SET. With 10^4 operations, even O(n) insertion per SET is fine. The other pitfall is duplicates: a SET on an existing key and timestamp must overwrite, not add a second entry. Check for an exact match after bisecting. Return an empty string for unknown keys or when every stored timestamp is greater than the query. If the floor logic or the overwrite case slips away under pressure, StealthCoder is the hedge for the live OA.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Time-Indexed Key-Value Store 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. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as time based key value store. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Together AI's OA.

Together AI reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Time-Indexed Key-Value Store FAQ

What's the trick in the Together AI time-indexed key-value store?+

Timestamps aren't guaranteed to be ordered, so you can't just append and binary search. Keep a sorted list of timestamps per key, insert with bisect, and answer GET with a floor search. Handle same-timestamp overwrites explicitly or you'll return stale values.

How hard is this problem really?+

Medium at most. It's a hash map plus binary search, and the logic is short. Difficulty comes from the out-of-order timestamps and the overwrite rule. If you've seen the standard time-based key-value store, this is a small twist on it.

What data structure should I use per key?+

Use two parallel structures: a sorted list of timestamps and a dict from timestamp to value. Bisect the list for the floor, then read the value from the dict. The dict also makes overwrites trivial, since you only insert into the list when the timestamp is new.

What edge cases should I test before submitting?+

Test an unknown key, a query earlier than every stored timestamp, an exact timestamp match, and a repeated SET at the same key and timestamp. Also test a SET at a later timestamp followed by an earlier one, like example 2. Those cover almost every wrong answer.

How do I prepare in 48 hours?+

Write the solution from scratch twice. Practice the bisect-right minus one floor idiom until it's automatic, then handle the empty result. Read the problem for what's different from the classic version. Here, that's the unordered timestamps and overwrites.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Together AI.

OA at Together AI?
Invisible during screen share
Get it