Tap here to switch tabs
Problem
Submissions

Problem: Largest Time for Given Digits

med
30 min
Try to solve the Largest Time for Given Digits problem.

Statement

Given an array arr consisting of 44 digits, return the latest valid 2424 hour time in "HH:MM" format that can be constructed by using all elements of arr exactly once.

If no valid time can be formed, return an empty string "".

Constraints:

  • arr.length =4= 4

  • 0≤0 \le arr[i] ≤9\le 9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Largest Time for Given Digits

med
30 min
Try to solve the Largest Time for Given Digits problem.

Statement

Given an array arr consisting of 44 digits, return the latest valid 2424 hour time in "HH:MM" format that can be constructed by using all elements of arr exactly once.

If no valid time can be formed, return an empty string "".

Constraints:

  • arr.length =4= 4

  • 0≤0 \le arr[i] ≤9\le 9