search:

Remove Invalid Parentheses

Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note The input string may contain letters other than the parentheses ( and ). *### Example 1 Input: "()())()" Output: ["()()()", "(())()"] *### Example 2 Input: "(a)())()" Output: ["(a)()()", "(a())()"] *### Example 3 Input: ")(" Output: [""] *### Solution # Credit: # Credit: https://leetcode.com/problems/remove-invalid-parentheses/discuss/186597/Very-easy-to-understand-Python-DFS class Solution(object): def removeInvalidParentheses(self, s): """ :type s: str :rtype: List[str] """ res = [] self.

by lek tin in "algorithm" access_time 2-min read

Word Search

Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once. Example board = [ ['A','B','C','E'], ['S','F','C','S'], ['A','D','E','E'] ] Given word = "ABCCED", return true. Given word = "SEE", return true. Given word = "ABCB", return false.

by lek tin in "algorithm" access_time 2-min read