Problem Statement | |||||||||||||
Given a int[] values containing positive integers return (quotes for clarity):
and freq is the number of times the most frequently occurring value occurred in the sequence. Neither numerator nor denominator should have any leading zeros. For example (quotes for clarity):
values = {1,2,4,11} return "ASCENDING 9/2" since the average is 18/4 = 9/2
values = {1,2,2,2,3,4} return "NONDESCENDING 3" since 2 occurred 3 times
values = {6,5,1} return "DESCENDING 4/1" since the average is 12/3 = 4/1
values = {5,5,4,4,1} return "NONASCENDING 2" since 5 occurred twice
values = {1,2,3,4,1} return "NOTHING" since no other choice is possible
| |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
| - | Be sure that you spell everything correctly. | ||||||||||||
Constraints | |||||||||||||
| - | values must contain between 2 and 50 elements inclusive | ||||||||||||
| - | At least 2 elements of values must be distinct | ||||||||||||
| - | Each element of values must be between 1 and 1000 inclusive | ||||||||||||
Examples | |||||||||||||
| 0) | |||||||||||||
| |||||||||||||
| 1) | |||||||||||||
| |||||||||||||
| 2) | |||||||||||||
| |||||||||||||
| 3) | |||||||||||||
| |||||||||||||
| 4) | |||||||||||||
| |||||||||||||
| 5) | |||||||||||||
| |||||||||||||
| 6) | |||||||||||||
| |||||||||||||
| 7) | |||||||||||||
| |||||||||||||
| 8) | |||||||||||||
| |||||||||||||
| 9) | |||||||||||||
| |||||||||||||
| 10) | |||||||||||||
| |||||||||||||