InterviewDB Question

Robot Command Line App: Parse and Execute a DSL for a Grid-Moving Robot

Question Details

Problem A robot starts at position (0, 0) facing North on an infinite grid. You are given a string of commands and must parse and execute them: F — move forward one step B — move backward one step L / R — rotate 90 degrees left/right REP n { ... } — repeat the enclosed commands n times Return the robot's final (x, y) position and facing direction. Example Follow-ups How would you implement this using a recursive descent parser vs. a stack-based approach? Add a JUMP label / LABEL name instruction…

Full Details

🔒

Unlock all Shopify questions

Full insider details, leaked discussions, and candidate experiences.

Get full access — $100 a year, unlimited access

About This Question

This is a reported interview question from a shopify interview.

It covers the following topics: Strings, Matrix, Recursion, Coding, Pair Programming, Stack .