Skip to content

Commit 1c11c80

Browse files
authored
Create 3114-latest-time-you-can-obtain-after-replacing-characters.js
1 parent 2b294c9 commit 1c11c80

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* @param {string} s
3+
* @return {string}
4+
*/
5+
var findLatestTime = function (s) {
6+
let l = s.split('')
7+
8+
if (l[0] === '?') {
9+
l[0] = l[1] === '?' || parseInt(l[1]) <= 1 ? '1' : '0'
10+
}
11+
12+
if (l[1] === '?') {
13+
l[1] = l[0] === '1' ? '1' : '9'
14+
}
15+
16+
if (l[3] === '?') {
17+
l[3] = '5'
18+
}
19+
20+
if (l[4] === '?') {
21+
l[4] = '9'
22+
}
23+
24+
return l.join('')
25+
}

0 commit comments

Comments
 (0)