You are viewing a single comment's thread. Return to all comments →
static long repeatedString(String s, long n) { long count = s.length()-s.replace("a", "").length(); long reps = n/s.length(); long rest = n%s.length(); count = count*reps; for(int i = 0; i<rest; i++){ if(s.charAt(i) == 'a') count++; } return count; }
Seems like cookies are disabled on this browser, please enable them to open this website
Repeated String
You are viewing a single comment's thread. Return to all comments →