Sha256: 5671d297592ce6ee9244b8cdedfeee50a662b3930edf44eb11275633a247e9b0
Contents?: true
Size: 543 Bytes
Versions: 285
Compression:
Stored size: 543 Bytes
Contents
using System.Linq; public static class BracketPush { public static bool IsPaired(string input) { var brackets = new string(input.Where(c => "[]{}()".Contains(c)).ToArray()); var previousLength = brackets.Length; while (brackets.Length > 0) { brackets = brackets.Replace("[]", "").Replace("{}", "").Replace("()", ""); if (brackets.Length == previousLength) return false; previousLength = brackets.Length; } return true; } }
Version data entries
285 entries across 188 versions & 1 rubygems