Recca Chao 的 gitHub page

推廣網站開發,包含 Laravel 和 Kotlin 後端撰寫、自動化測試、讀書心得等。Taiwan Kotlin User Group 管理員。

View on GitHub

Problem 27

Description

This problem was asked by Facebook.

Given a string of round, curly, and square open and closing brackets, return whether the brackets are balanced (well-formed).

For example, given the string ([])[]({}), you should return true.

Given the string ([)] or (((), you should return false.

Solutions

參考 leet code

https://leetcode.com/problems/valid-parentheses/

假設題目如下

class Solution {
    fun isValid(s: String): Boolean {
    }
}

參考解法