mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-11 22:20:34 +08:00
26 lines
422 B
Go
26 lines
422 B
Go
package leetcode
|
|
|
|
func maximumTime(time string) string {
|
|
timeb := []byte(time)
|
|
if timeb[3] == '?' {
|
|
timeb[3] = '5'
|
|
}
|
|
if timeb[4] == '?' {
|
|
timeb[4] = '9'
|
|
}
|
|
if timeb[0] == '?' {
|
|
if int(timeb[1]-'0') > 3 && int(timeb[1]-'0') < 10 {
|
|
timeb[0] = '1'
|
|
} else {
|
|
timeb[0] = '2'
|
|
}
|
|
}
|
|
if timeb[1] == '?' {
|
|
timeb[1] = '9'
|
|
}
|
|
if timeb[0] == '2' && timeb[1] == '9' {
|
|
timeb[1] = '3'
|
|
}
|
|
return string(timeb)
|
|
}
|