Reported April 2024
Alarm.com

Days Since Last Login

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

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

Alarm.com asked this in April 2024, and it's a deceptive problem. You see "Days Since Last Login" and think time-series or date arithmetic, but the real trick is simpler. You're likely calculating the difference between two timestamps or tracking state across user records. StealthCoder sits silent until you hit the wall on edge cases around null values, timezone handling, or off-by-one errors in your date math. That's when the safety net matters.

Pattern and pitfall

This problem usually boils down to: given a dataset of user login events, compute how many days have elapsed since each user's most recent login. The pitfall is forgetting to handle users with no login history, comparing dates across different formats, or miscounting the day boundary. You'll iterate through records, track the maximum (most recent) login per user, then subtract from a reference date. The math itself is straightforward, but the data wrangling kills candidates who rush. StealthCoder can whisper the reference date logic and remind you of the edge case structure if you blank mid-implementation.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Days Since Last Login 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. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Alarm.com's OA.

Alarm.com reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Days Since Last Login FAQ

Is this a sorting or grouping problem?+

Both, but grouping by user ID is the heavier lift. Sort login events by timestamp within each group, grab the max, then calculate the delta. Hash-table or dictionary for the grouping step makes it clean.

How do I handle users who have never logged in?+

That depends on the spec, but usually you either exclude them, return null/0, or return a sentinel value like -1. Read the problem statement carefully. Alarm.com likely wants a defined behavior here.

What if login timestamps are in different timezones?+

Normalize everything to UTC first, or assume all inputs are already in the same timezone. Don't overthink it unless the problem explicitly mentions timezone data. Most OA problems keep this implicit.

Should I account for leap years or daylight saving time?+

Use your language's built-in date library. Python's datetime, JavaScript's Date, Java's LocalDateTime all handle this for you. Don't roll your own date math.

What's the time complexity I'm aiming for?+

O(n log n) for sorting events, O(n) for grouping. O(n) overall is fine. If you're asked to optimize further, you'd need more context on the data structure.

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

OA at Alarm.com?
Invisible during screen share
Get it