You are viewing a single comment's thread. Return to all comments →
check this out...
public class Solution {
public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int rem=0,s=0,t=0; while(n>0) { rem=n%2; n=n/2; if(rem==1) { s++; if(s>=t) t=s; } else{ s=0; } } System.out.println(t); }
}
Day 10: Binary Numbers
You are viewing a single comment's thread. Return to all comments →
check this out...
public class Solution {
}