EASYasked at 1 company

Last Visited Integers

A easy-tier problem at 61% community acceptance, tagged with Array, Simulation. Reported in interviews at General Motors and 0 others.

Founder's read

Last Visited Integers is an easy array simulation problem with a 61% acceptance rate, asked by General Motors. The trick isn't algorithmic complexity; it's tracking state correctly as you iterate through commands. You're managing a list of integers and processing queries that ask for the last element added before a certain point in time. Most candidates fail because they misread what 'last' means in context or don't simulate the full command sequence cleanly. If this problem hits your live OA and you freeze on the state management, StealthCoder surfaces the working solution in seconds, invisible to the proctor.

Companies asking
1
Difficulty
EASY
Acceptance
61%

Companies that ask "Last Visited Integers"

If this hits your live OA

Last Visited Integers 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 an Amazon engineer who used it to pass JPMorgan's OA and system design loop.

Get StealthCoder
What this means

The pattern here is pure simulation. You maintain an array and process two types of commands: add an integer, or query the last integer added within a specific time window. The gotcha is that 'last' doesn't mean the most recent globally; it means the most recent before a given index or timestamp. Most candidates either forget to track indices correctly or try to optimize when a clean, linear pass through commands is the intended solution. Array and simulation problems like this reward clarity over cleverness. Walk through the commands in order, keep your state explicit (the current list, the current position), and build the answer step by step. If you haven't drilled this exact pattern before and you hit it live, StealthCoder runs invisibly and hands you a working approach so you don't lose points.

Pattern tags

The honest play

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

Last Visited Integers recycles across companies for a reason. It's easy-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 an Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Last Visited Integers interview FAQ

How hard is Last Visited Integers really?+

It's genuinely easy. The 61% acceptance rate reflects that the problem reads like a toy until you implement it wrong. Once you simulate cleanly without over-engineering, it's five to ten minutes. The trap is overthinking the 'last' logic instead of just following the command sequence.

Is this the kind of problem General Motors still asks?+

It's in their reported interview pool, so yes. General Motors conducts online assessments that include array simulation problems at the easy tier. This exact problem may or may not appear, but the pattern is fair game for their pipeline.

What's the trick to Last Visited Integers?+

Track state cleanly. Maintain the current list of integers and process commands in order. Don't try to precompute or optimize; simulate. The 'last visited' logic is just a filtered lookup into your array at a specific index range. Code it straightforward.

How does simulation relate to array problems in interviews?+

Simulation problems test your ability to follow instructions precisely and maintain state over multiple steps. They're easier than dynamic programming or greedy, but they reward clean code. Interviewers use them to see if you read the problem carefully and implement without bugs.

What if I blank on the indexing during the live OA?+

That's what StealthCoder is for. If you freeze on off-by-one errors or get confused about which command maps to which query, it runs invisibly during the assessment and delivers a working solution so you can move on and stop the clock.

Want the actual problem statement? View "Last Visited Integers" 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.