Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit558e6ba

Browse files
add 1736
1 parenta352352 commit558e6ba

File tree

3 files changed

+54
-59
lines changed

3 files changed

+54
-59
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1736|[Latest Time by Replacing Hidden Digits](https://leetcode.com/problems/latest-time-by-replacing-hidden-digits/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1736.java)||Easy|String, Greedy|
1112
|1733|[Minimum Number of People to Teach](https://leetcode.com/problems/minimum-number-of-people-to-teach/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1733.java)||Medium|Array, Greedy|
1213
|1732|[Find the Highest Altitude](https://leetcode.com/problems/find-the-highest-altitude/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1732.java)||Easy|Array|
1314
|1727|[Largest Submatrix With Rearrangements](https://leetcode.com/problems/largest-submatrix-with-rearrangements/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1727.java)||Medium|Greedy, Sort|

‎src/main/java/com/fishercoder/solutions/Contest.java

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
packagecom.fishercoder.solutions;
2+
3+
publicclass_1736 {
4+
publicstaticclassSolution1 {
5+
publicStringmaximumTime(Stringtime) {
6+
StringBuildersb =newStringBuilder();
7+
String[]strs =time.split(":");
8+
Stringhour =strs[0];
9+
Stringmin =strs[1];
10+
if (hour.charAt(0) =='?') {
11+
if (hour.charAt(1) =='?') {
12+
sb.append("23");
13+
}elseif (hour.charAt(1) >'3') {
14+
sb.append("1");
15+
sb.append(hour.charAt(1));
16+
}else {
17+
sb.append("2");
18+
sb.append(hour.charAt(1));
19+
}
20+
}elseif (hour.charAt(0) =='0' ||hour.charAt(0) =='1') {
21+
if (hour.charAt(1) =='?') {
22+
sb.append(hour.charAt(0));
23+
sb.append("9");
24+
}else {
25+
sb.append(hour);
26+
}
27+
}elseif (hour.charAt(0) =='2') {
28+
if (hour.charAt(1) =='?') {
29+
sb.append("23");
30+
}else {
31+
sb.append(hour);
32+
}
33+
}
34+
sb.append(":");
35+
if (min.charAt(0) =='?') {
36+
if (min.charAt(1) =='?') {
37+
sb.append("59");
38+
}else {
39+
sb.append("5");
40+
sb.append(min.charAt(1));
41+
}
42+
returnsb.toString();
43+
}
44+
sb.append(min.charAt(0));
45+
if (min.charAt(1) =='?') {
46+
sb.append("9");
47+
}else {
48+
sb.append(min.charAt(1));
49+
}
50+
returnsb.toString();
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp