#86. 数组中1和2的顺序查找

    ID: 86 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatArray-2gesp3一维数组循环结构

数组中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 11 in the array with a 22 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 true if the condition is met; otherwise, output false.

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]. 11 is at index 00, and 22 is at index 22. Since 22 appears after 11, it returns true. Sample 2: The array is [3 1 2]. 11 is at index 11, and 22 is at index 22. Since 22 appears after 11, it returns true. Sample 3: The array is [3 1 4 5 2]. 11 is at index 11, and 22 is at index 44. Since 22 appears after 11, it returns true.

Constraints

Time limit: 11 second, Memory limit: 10241024 KiB.