You are viewing a single comment's thread. Return to all comments →
public static string isBalanced(string s) { var lastLength = -1; while(s.Length != lastLength){ lastLength = s.Length; s = s.Replace("{}", ""); s = s.Replace("[]", ""); s = s.Replace("()", ""); } return s.Length == 0 ? "YES" : "NO"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Balanced Brackets
You are viewing a single comment's thread. Return to all comments →