Character Reprogramming (Backend)

Problem Overview

  • Given a sequence of moves U, D, L, R that control a character on a screen.
  • Find the maximum number of instructions that can be deleted while keeping the same final position.
  • Input: original move string; Output: maximum deletions; constraints: N/A.
  • Real-world context: optimize a control device’s movement script.
  • From Canva interviews; a coding interview problem and common interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: