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

Commit4867456

Browse files
add 2042
1 parent43420ac commit4867456

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
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+
|2042|[Check if Numbers Are Ascending in a Sentence](https://leetcode.com/problems/check-if-numbers-are-ascending-in-a-sentence/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2042.java)||Easy||
1112
|2039|[The Time When the Network Becomes Idle](https://leetcode.com/problems/the-time-when-the-network-becomes-idle/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2039.java)||Medium||
1213
|2038|[Remove Colored Pieces if Both Neighbors are the Same Color](https://leetcode.com/problems/remove-colored-pieces-if-both-neighbors-are-the-same-color/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2038.java)||Medium||
1314
|2037|[Minimum Number of Moves to Seat Everyone](https://leetcode.com/problems/minimum-number-of-moves-to-seat-everyone/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2037.java)||Easy||
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
packagecom.fishercoder.solutions;
2+
3+
publicclass_2042 {
4+
publicstaticclassSolution1 {
5+
publicbooleanareNumbersAscending(Strings) {
6+
String[]words =s.split("\\ ");
7+
intprev =0;
8+
for (Stringword :words) {
9+
if (Character.isDigit(word.charAt(0))) {
10+
if (Integer.parseInt(word) <=prev) {
11+
returnfalse;
12+
}else {
13+
prev =Integer.parseInt(word);
14+
}
15+
}
16+
}
17+
returntrue;
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp