Skip to content

Commit 1cd5bb4

Browse files
committed
add sol
1 parent 0716645 commit 1cd5bb4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

leetcode/daily/1752/sol.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func check(nums []int) bool {
6+
n := len(nums)
7+
cnt := 0
8+
9+
for i, v := range nums {
10+
if v > nums[(i+1)%n] {
11+
cnt++
12+
}
13+
}
14+
15+
return cnt <= 1
16+
}
17+
18+
func main() {
19+
nums := []int{3,4,5,1,2}
20+
fmt.Println(check(nums))
21+
}

0 commit comments

Comments
 (0)