Practice Cracking the Safe
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
There is a safe protected by a password. The password is a sequence of n digits where each digit can be in the range [0, k - 1]. The safe has a peculiar way of checking the password. When you enter in a sequence, it checks the most recent n digits that were entered each time you type a digit. Return any string of minimum length that will unlock the safe at some point of entering it.
Source: Cracking the Safe on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
n = 1, k = 2
"10"
# Example 2
n = 2, k = 2
"01100"
Constraints
Related LeetCode Problems
Practice more problems similar to Cracking the Safe.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.