Practice Largest Time for Given Digits
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
Given an array arr of 4 digits, find the latest 24-hour time that can be made using each digit exactly once. 24-hour times are formatted as "HH:MM", where HH is between 00 and 23, and MM is between 00 and 59. The earliest 24-hour time is 00:00, and the latest is 23:59. Return the latest 24-hour time in "HH:MM" format. If no valid time can be made, return an empty string.
Source: Largest Time for Given Digits on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
arr = [1,2,3,4]
"23:41"
# Example 2
arr = [5,5,5,5]
""
Constraints
Related LeetCode Problems
Practice more problems similar to Largest Time for Given Digits.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.