Hey guys,
From what I can tell the code is working fine with Run but not able to be verified, I am not sure why, though.
Can someone please give me a hint?
Thank you!
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> numbers = new ArrayList<Integer>();
ArrayList<Integer> count = new ArrayList<Integer>();
int temp = 0;
int countN = 1;
for(int i = 0; i < 10; i++) {
int tempNo = Integer.parseInt(reader.readLine());
if (i == 0) temp = tempNo;
else
if(temp == tempNo) {
countN++;
}
else
{
temp = tempNo;
count.add(countN);
countN = 1;
}
if (i == 9) count.add(countN);
numbers.add(tempNo);
}
int max = 0;
for(int i = 1; i < count.size(); i++) {
if (max < count.get(i)) max = count.get(i);
}
System.out.println(max);
}
}