User Logins
Reported by candidates from Paypal's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
PayPal's User Logins question hit candidates in March 2024, and it's a deceptively simple problem that trips people up on edge cases. You're likely dealing with a dataset of login events: timestamps, user IDs, maybe IP addresses or locations. The trap isn't the algorithm. It's clarity on what the problem actually wants you to count, filter, or validate. StealthCoder will anchor you if you misread the requirement under pressure, since the problem statement itself can feel vague on first pass.
Pattern and pitfall
This is fundamentally a hash-table or counting problem wrapped in real-world language. You'll probably need to group logins by user, detect anomalies (multiple locations, rapid succession), or flag suspicious activity. The common pitfall: candidates code fast and assume the problem wants one thing (like 'count unique users') when it actually wants another (like 'flag accounts with logins from two cities within 10 minutes'). Time-series logic matters here. Sort by timestamp, iterate through events, and use a hash map to track state per user. Edge cases kill you: what if a user logs in twice from the same IP in one second? What if the input is unsorted? Have StealthCoder as your safety net to clarify the exact definition of 'suspicious' or 'duplicate' if you blank mid-OA.
Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.
You can drill User Logins 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 for the candidate who got the OA invite this morning and has 72 hours, not six months.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Paypal's OA.
Paypal reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.
User Logins FAQ
Is this a counting problem or a validation problem?+
Likely both. You'll count logins per user and then validate them against a rule (impossible travel, too-frequent logins, new device, etc.). Read the full problem text carefully. PayPal cares about fraud detection, so expect a flagging or filtering component, not just raw counts.
Do I need to sort the input?+
Almost certainly yes. Logins come as events, and you need chronological order to detect patterns like impossible travel (login in New York at 2pm, then London at 2:05pm). Sort by timestamp first, then iterate.
What's the trap with the hash table here?+
You might hash by user ID alone and lose temporal information. Instead, hash by user ID and track a list or queue of recent logins with their metadata (timestamp, location, IP). This lets you compare consecutive events.
How fast can I code this in an OA setting?+
Hash-table logic is solid for 20-30 minutes if you read carefully. The trick is nailing the problem definition in the first 5 minutes. If you're unclear, re-read before coding. A wrong solution coded fast is a fail.
Should I expect a follow-up or optimization question?+
Possibly. After you solve the basic version, they might ask for efficiency at scale (millions of logins) or real-time detection. That's when you'd optimize your hash structure or use a sliding window for recent events only.