Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
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
Report
Report seen similar question in interview
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
python
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected