Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let input = ['10', '2', '1', '1', '2', '3', '3', '2', '2', '2', '1'];
- let print = this.print || console.log;
- let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
- const n = +gets();
- let maxCount = 1;
- for(let i = 0; i < n; i++) {
- const arr = gets().split(', ').map(Number);
- let count = 1;
- let elToCompare = arr[i];
- for(let j = i + 1; j < n; j++) {
- let el = arr[j];
- if(el === elToCompare) {
- count++;
- } else {
- break;
- }
- }
- if(count > maxCount) {
- maxCount = count;
- }
- }
- print(maxCount);
Advertisement
Add Comment
Please, Sign In to add comment