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

Commit7f39896

Browse files
authored
Create 0896-monotonic-array.kt
1 parent4b5c539 commit7f39896

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎kotlin/0896-monotonic-array.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
classSolution {
2+
funisMonotonic(nums:IntArray):Boolean {
3+
if (nums[nums.lastIndex]- nums[0]<0)
4+
nums.reverse()
5+
6+
for (iin0 until nums.lastIndex) {
7+
if (!(nums[i]<= nums[i+1]))
8+
returnfalse
9+
}
10+
11+
returntrue
12+
}
13+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp