1736. Latest Time by Replacing Hidden Digits Easy

@problem@discussion
#String#Greedy



1/**
2 * [1736] Latest Time by Replacing Hidden Digits
3 *
4 * You are given a string time in the form of  hh:mm, where some of the digits in the string are hidden (represented by ?).
5 * The valid times are those inclusively between 00:00 and 23:59.
6 * Return the latest valid time you can get from time by replacing the hidden digits.
7 *  
8 * Example 1:
9 * 
10 * Input: time = "2?:?0"
11 * Output: "23:50"
12 * Explanation: The latest hour beginning with the digit '2' is 23 and the latest minute ending with the digit '0' is 50.
13 * 
14 * Example 2:
15 * 
16 * Input: time = "0?:3?"
17 * Output: "09:39"
18 * 
19 * Example 3:
20 * 
21 * Input: time = "1?:22"
22 * Output: "19:22"
23 * 
24 *  
25 * Constraints:
26 * 
27 * 	time is in the format hh:mm.
28 * 	It is guaranteed that you can produce a valid time from the given string.
29 * 
30 */
31pub struct Solution {}
32
33// problem: https://leetcode.com/problems/latest-time-by-replacing-hidden-digits/
34// discuss: https://leetcode.com/problems/latest-time-by-replacing-hidden-digits/discuss/?currentPage=1&orderBy=most_votes&query=
35
36// submission codes start here
37
38impl Solution {
39    pub fn maximum_time(time: String) -> String {
40        String::new()
41    }
42}
43
44// submission codes end
45
46#[cfg(test)]
47mod tests {
48    use super::*;
49
50    #[test]
51    fn test_1736() {
52    }
53}
54


Back
© 2025 bowen.ge All Rights Reserved.