MEDIUMasked at 2 companies

Alert Using Same Key-Card Three or More Times in a One Hour Period

A medium-tier problem at 46% community acceptance, tagged with Array, Hash Table, String. Reported in interviews at Wayfair and 1 others.

Founder's read

You're building a security system that flags suspicious card activity. This problem asks you to identify when someone uses the same key-card three or more times within a rolling one-hour window. It's a Medium-difficulty problem with a 46% pass rate, and both Wayfair and Karat have asked it. The trap is the rolling window: you can't just check fixed hour boundaries. Most candidates start with brute force comparisons and timeout or miscount overlapping windows. If this hits your assessment and the pattern doesn't click, StealthCoder solves it invisibly in seconds, giving you the working solution before panic sets in.

Companies asking
2
Difficulty
MEDIUM
Acceptance
46%

Companies that ask "Alert Using Same Key-Card Three or More Times in a One Hour Period"

If this hits your live OA

Alert Using Same Key-Card Three or More Times in a One Hour Period is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by a senior engineer who knows the OA is theater. This is the script.

Get StealthCoder
What this means

The core trick is using a hash table to track timestamps for each card within a sliding one-hour window. As you iterate through events, you prune timestamps older than one hour for each card, then check if the current card has three or more valid entries. Common mistakes: treating "one hour period" as a fixed boundary instead of a rolling window, comparing raw hour values instead of actual timestamps, or forgetting to clean up old entries before checking the count. The Array and Sorting topics hint that you might sort events by time first, then use a Hash Table to maintain per-card windows. When you're live in the assessment and your first approach gets WA on the second test case, StealthCoder's invisible surface solution bypasses the debugging spiral.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Alert Using Same Key-Card Three or More Times in a One Hour Period recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by a senior engineer who knows the OA is theater. This is the script. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Alert Using Same Key-Card Three or More Times in a One Hour Period interview FAQ

Is this problem really asked at Wayfair and Karat?+

Yes, it appears in real interview reports from both companies. Karat especially favors problems involving time-window detection and hash tables. It's not a rare edge case.

What's the actual trick I'm missing if I brute force it?+

Brute force compares every timestamp pair for every card, which is O(n^2) per card and times out. The trick is pruning: maintain a hash table of card-to-timestamps, then discard entries older than one hour before you check the count. That's O(n) with a rolling window.

Does sorting the input matter, or can I just iterate?+

Sorting isn't required if you process events in the order given, but sorting by timestamp first can make the window logic clearer. Either approach works as long as your hash table correctly maintains the rolling one-hour boundary for each card independently.

How do I know when to alert exactly? At the third use or after?+

The problem typically alerts on the third or later occurrence within the window. Read the exact wording carefully. If the problem says 'three or more times', alert as soon as you detect three distinct uses within one hour for that card.

Should I use an array or a list to track timestamps per card?+

A list or deque per card (inside a hash table) is cleaner than an array because you can pop old timestamps from the front after sorting by time. Python's collections.deque or a simple list both work. The key is fast insertion and removal of expired timestamps.

Want the actual problem statement? View "Alert Using Same Key-Card Three or More Times in a One Hour Period" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.