← Applied Intuition Interview Insights

Applied Intuition·Mobile Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

This was a follow-up coding round at Applied Intuition for a Mobile Engineer role, building on a button click detector from a previous part. The twist was dropping the fixed 10ms sampling assumption and working with real timestamps instead.

Questions Asked (1)

Q1

You've already built a button click detector that assumes state updates arrive every 10ms. Now the updates can arrive at any time. Rework the detector to use real timestamps from a provided now() call, keeping the same single click (<=200ms) and long click (>=500ms) thresholds.

Algorithms & Data StructuresTechnical Trade-offsSystem Design
Author's notes

The part 1 version felt clean because you could just count samples.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem: the detector must use real timestamps from now() to measure press duration, not assume fixed intervals. Then outline a state machine that records the press start time and, on release, computes the duration to classify as single click or long click. Finally, discuss edge cases like multiple presses, clock drift, and how to handle long clicks that trigger before release.

Pro tip: Mention that you would use monotonic time (e.g., performance.now() or SystemClock.uptimeMillis()) rather than wall-clock time to avoid issues with system clock changes. Also, consider debouncing or ignoring rapid successive presses to prevent unintended double clicks.

1. Clarify requirements and assumptions

Confirm that now() returns a monotonically increasing timestamp in milliseconds, and that the detector should classify a press as a single click if duration <=200ms, long click if >=500ms, and ignore durations in between.

2. Design state machine

Define states: IDLE, PRESSED, and possibly LONG_CLICK_TRIGGERED. On press, record start time = now(). On release, compute duration = now() - start time and classify accordingly.

3. Handle long click during press

If a long click should fire as soon as the threshold is reached (even before release), schedule a timer or check elapsed time periodically using now() to trigger the long click event.

4. Address edge cases

Consider multiple rapid presses, clock drift, and ensure that a long click is not also reported as a single click. Use a flag to track if long click was already fired.

5. Test and validate

Propose unit tests with mocked now() to simulate various timings, including boundary cases (exactly 200ms, 500ms) and irregular intervals.

Key Points to Mention

  • Use of monotonic clock to avoid system time changes
  • State machine with IDLE, PRESSED, and LONG_CLICK_TRIGGERED states
  • Recording start timestamp on press and computing duration on release
  • Handling long click that triggers before release (if required)
  • Boundary conditions: exactly 200ms and 500ms
  • Debouncing or ignoring rapid successive presses to prevent double clicks

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.