24 lines
327 B
Go
24 lines
327 B
Go
package q334
|
|
|
|
import "math"
|
|
|
|
func increasingTriplet(nums []int) bool {
|
|
if len(nums) < 3 {
|
|
return false
|
|
}
|
|
|
|
first, second := math.MaxInt, math.MaxInt
|
|
|
|
for _, x := range nums {
|
|
if x <= first {
|
|
first = x
|
|
} else if x <= second {
|
|
second = x
|
|
} else {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
var _ = increasingTriplet
|