We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Sherlock and the Valid String
Sherlock and the Valid String
Sort by
recency
|
2004 Discussions
|
Please Login in order to post a comment
public static String isValid(String s) { int freq[]=new int[26]; int i,n=s.length(); if(n<=1) return "YES"; for(i=0;imaxFreq) maxFreq=freq[i]; } for(i=0;i<26;i++) {
JAVA 8
The test case that most people seem to be missing out is similar to this one - "aaaabbbbc" where removing just 1 character (c) results in a valid string
Ruby
Kotlin/java solution using map