#86. 数组中1和2的顺序查找
数组中1和2的顺序查找
One and Two in Array
Background
Congcong is currently learning about array operations and has encountered an interesting problem.
Problem Description
Given an array of integers, return true if there is a in the array with a somewhere later in the array. Otherwise, return false.
Input Format
Input is given from Standard Input in the following format.
A single line containing multiple integers, representing the elements of the array. Integers are separated by spaces.
Output Format
Output is printed to Standard Output in the following format.
Output
trueif the condition is met; otherwise, outputfalse.
Sample
[1 3 2]
true
[3 1 2]
true
[3 1 4 5 2]
true
Sample Explanation
Sample 1: The array is [1 3 2]. is at index , and is at index . Since appears after , it returns true.
Sample 2: The array is [3 1 2]. is at index , and is at index . Since appears after , it returns true.
Sample 3: The array is [3 1 4 5 2]. is at index , and is at index . Since appears after , it returns true.
Constraints
Time limit: second, Memory limit: KiB.