#92. 判断数组是否存在连续递增三元组
判断数组是否存在连续递增三元组
Consecutive Increasing Triplets
Background
Congcong is currently studying the properties of sequences. He wants to know if a certain special pattern exists within a sequence.
Problem Description
Return true if the array contains, somewhere, three increasing adjacent numbers like or . Otherwise, return false.
Input Format
Input is given from standard input in the following format.
The input consists of a single line containing a series of space-separated integers, representing the elements of the array.
Output Format
Output to standard output in the following format.
Output
trueif the array contains three consecutive increasing numbers; otherwise, outputfalse.
Sample
[1 4 5 6 2]
true
[1 2 3]
true
[1 2 4]
false
Sample Explanation
- Sample 1: The array contains , which are three consecutive increasing numbers, so the output is
true. - Sample 2: The array contains , which are three consecutive increasing numbers, so the output is
true. - Sample 3: The array does not contain three consecutive increasing numbers, so the output is
false.
Constraints
Time limit: 1 second, Memory limit: 1024 KiB for each test case.