Check Occurrences in java
You will be given an array and you need to find the whether there is any element occurring thrice. If yes, then print 'True' else print 'False'
Input Format -
You will be taking a number as an input from STDIN which tells about the length of the array. On another line, array elements should be there with single space between them.
Output Format -
You need to print the Boolean value.
Sample Test Case:
Sample Input:-12
9 8 7 7 8 6 5 4 7 8 1 2
Sample Output -
True
Explanation:
Elements 8 and 7 occurring Thrice and hence printing 'True'.
Input Format -
You will be taking a number as an input from STDIN which tells about the length of the array. On another line, array elements should be there with single space between them.
Output Format -
You need to print the Boolean value.
Sample Test Case:
Sample Input:-12
9 8 7 7 8 6 5 4 7 8 1 2
Sample Output -
True
Explanation:
Elements 8 and 7 occurring Thrice and hence printing 'True'.
Comments
Post a Comment