New
ML System Design & SQL tracks just landed
See what's new
×
Question Bank
Pricing
Blog
Forum
HOT
Referral
Description
Solution
Discussion
Submissions
Ask AI
Question Bank
Anthropic
Coding Question
AI Insights
Quick Summary
Simulate a simple instruction sequence starting from index zero.
Track executed instruction indices to identify when execution revisits a previous step.
Return the index of the first repeated instruction, or -1 if the program terminates normally.
What This Tests
Program simulation and state management
Cycle detection in deterministic sequences
Efficient lookup structures for visited states
Control flow manipulation via program counter
Common Patterns
Simulation
Hashing
Collapse
Hint 1
Hint 2
Hint 3
What Interviewers May Ask Next
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Qwen
Qwen3.6-Flash
0/2000
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected