Flag Hosts With Distinct-Source Failed Logon Bursts

Last updated: November 29, 2026

Quick Overview

You receive a time-ordered stream of authentication events (timestamp, host, source IP, success flag). Return, for each host, the first timestamp at which it saw failed logons from at least k distinct source IPs within a sliding window of W seconds.

CrowdStrike
Coding & Algorithms
Software Engineer
CrowdStrike
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


You receive a time-ordered stream of authentication events (timestamp, host, source IP, success flag). Return, for each host, the first timestamp at which it saw failed logons from at least k distinct source IPs within a sliding window of W seconds.

Falcon Identity Protection and Next-Gen SIEM detections look for password spraying and brute force against domain controllers, which reduces to sliding-window counting per entity. Interviewers want a streaming solution that keeps per-host state small and evicts correctly at window edges.

What the Interviewer Expects
  • Process events in one pass, suitable for a stream
  • Keep per-host deques plus per-IP counts so the distinct count is O(1)
  • Evict events that fall out of the window with a clearly defined boundary
  • Ignore successful logons and stop tracking a host once it is flagged
  • Discuss memory growth across many hosts
Key Topics to Cover
Sliding window
Hash maps
Deques
Streaming detection
Identity threat detection
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you shard this across many consumers reading a partitioned event stream?
  • What changes if events can arrive up to 30 seconds late?
  • How would you alert on a single source IP failing against many hosts (spraying) instead?
  • How do you bound memory when an attacker uses millions of distinct IPs?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Events are sorted by timestamp. The window ending at time ts covers (ts - W, ts]. A host is flagged the first time the number of distinct source IPs among its failed logons in that window reaches ...

High-Level Design

Per host, keep a deque of (ts, ip) failures inside the window and a counter ip -> occurrences in window. The number of keys in the counter is the distinct count. On each failure, append, increment...


Submit Your Answer
Markdown supported

Related Questions