#81. 判断数组是否同时包含1和4
判断数组是否同时包含1和4
Array Contains No 1 or 4
Background
Congcong is currently learning about array operations and encountered a problem involving array element checks.
Problem Description
Given an array of integers, return true if it contains no 's or it contains no 's. Otherwise, return false.
Input Format
Input is given from standard input in the following format.
The first line contains an integer , representing the length of the array. The second line contains integers, representing the elements of the array.
Output Format
Output to standard output in the following format.
Output
trueif the condition is met; otherwise, outputfalse.
Sample
3
1 2 3
true
4
1 2 3 4
false
3
2 3 4
true
Sample Explanation
- Sample 1: The array
[1, 2, 3]contains but does not contain , so it returnstrue. - Sample 2: The array
[1, 2, 3, 4]contains both and , so it returnsfalse. - Sample 3: The array
[2, 3, 4]contains but does not contain , so it returnstrue.
Constraints
Each element in the array satisfies .