Skip to content

Commit

Permalink
add sol
Browse files Browse the repository at this point in the history
  • Loading branch information
ductnn committed Feb 2, 2025
1 parent 0716645 commit 1cd5bb4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions leetcode/daily/1752/sol.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main

import "fmt"

func check(nums []int) bool {
n := len(nums)
cnt := 0

for i, v := range nums {
if v > nums[(i+1)%n] {
cnt++
}
}

return cnt <= 1
}

func main() {
nums := []int{3,4,5,1,2}
fmt.Println(check(nums))
}

0 comments on commit 1cd5bb4

Please sign in to comment.