You are viewing a single comment's thread. Return to all comments →
public static string superReducedString(string s) { if(s.Length == 1) return s; var i=1; while(i < s.Length){ if(s.Substring(i-1, 1) == s.Substring(i, 1)){ s = s.Remove(i-1, 2); if(i>1) i--; } else { i++; } } return s == "" ? "Empty String" : s; }
Seems like cookies are disabled on this browser, please enable them to open this website
Super Reduced String
You are viewing a single comment's thread. Return to all comments →