20. Valid Parentheses
Дана строка, s содержащая только символы '(', ')', '{', '}', '['и ']', определите, является ли входная строка допустимой. Входная строка действительна, если: Example 1: Input: s = "()" Output: true Example 2: Input: s = "()[]{}" Output: true Example 3: Input: s = "(]" Output: false Example 4: Input: s = "([])" Output: true Ограничения: пример решения на Go:
func isValid(s string) bool { var notChange bool var countPrev,countNext int for !notChange { nextCheck: for i, r := range s { if i < len(s)-1 { if check(r, rune(s[i+1])) { if len(s) == 2 { return true } s = s[:i]+s[i+2:] goto...