FastPrepCharacter Reprogramming (Backend)
Problems/Character Reprogramming (Backend)

Character Reprogramming (Backend)

Canva logoCanva● EasyINTERNOA

Updated Sep 2026

QuestionFunctionExamples

Problem statement

A control device has 4 buttons that can be used to move a character around a screen in 4 directions: Up (U), Down (D), Left (L), and Right (R). The movement needs to be optimized by deleting unnecessary instructions while maintaining the same destination. Given the original set of instructions, what is the maximum number of instructions that can be deleted and still have the character reach the destination?

Note: The instructions that are deleted do not need to be contiguous.

Function

maxDeletions(s: String) → int

Examples

Example 1

s = "RRR"return = 0
Example 1 illustration

There is nothing that can be deleted from these instructions, so the answer is 0.

More Canva interview questions

  • Counting Binary Substrings (Backend)OA · Seen May 2026
  • Element SwappingOA · Seen Jul 2025
  • Women in STEM CharityOA · Seen Jul 2025
  • Order Check (Backend)OA · Seen Apr 2024

Similar questions at other companies

  • Identification Number Check DigitAbridge · OAAbridge interview questions
  • Count Substrings With Identical CharactersVirtu Financial · OAVirtu Financial interview questions
  • Count Multiples of Three with Two SevensHudson River Trading · OAHudson River Trading interview questions
  • Is This Date a Weekend?Salesforce · OASalesforce interview questions
  • Triple-Position Alphabet EncodingArm · OA
  • Closest ColorTwo Sigma · OATwo Sigma interview questions
  • Prime Number From a StringAdobe · OAAdobe interview questions
  • Sum Integer StringsIntuit · OAIntuit interview questions
  • Digit Changes for a Multiple of 9Nutanix · OANutanix interview questions
  • Count Times Using at Most Two DigitsLSEG · OALSEG interview questions
All Canva interview questionsSee Canva hiring insights
Saved
class Solution {
    public int maxDeletions(String s) {
      // write your code here
    }

}
Checking account…