add new solutions
This commit is contained in:
parent
ca24d0a56a
commit
0c73608ce5
36 changed files with 791 additions and 0 deletions
25
solutions/33/q3349/solution.go
Normal file
25
solutions/33/q3349/solution.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package q3349
|
||||
|
||||
func hasIncreasingSubarrays(nums []int, k int) bool {
|
||||
seqLen := 1
|
||||
prevSeqTail := -2
|
||||
for i := 1; i < len(nums); i++ {
|
||||
if nums[i-1] < nums[i] {
|
||||
seqLen++
|
||||
if seqLen == k && prevSeqTail == i-k {
|
||||
return true
|
||||
}
|
||||
if seqLen >= 2*k {
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
if seqLen >= k {
|
||||
prevSeqTail = i - 1
|
||||
}
|
||||
seqLen = 1
|
||||
}
|
||||
}
|
||||
return k == 1
|
||||
}
|
||||
|
||||
var _ = hasIncreasingSubarrays
|
||||
Loading…
Add table
Add a link
Reference in a new issue