Advertisement
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 gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
- let arrLength = +gets();
- let arr = [];
- let maxEquals=1;
- let currentEquals=1;
- for(let i = 1; i <= arrLength; i++){
- let arrNums = gets();
- arr.push(parseInt(arrNums));
- if(arr[i] === arr[i-1]){
- currentEquals + 1;
- if(currentEquals > maxEquals){
- maxEquals = currentEquals;
- }
- }else{
- currentEquals = 1;
- }
- // console.log(maxEquals);
- }
- // console.log(arr)
- console.log(maxEquals);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement