Problem Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. Example1 Input: s1 = “aabcc”, s2 = “dbbca”, s3 = “aadbbcbcac” Output: true Example2 Input: s1 = “aabcc”,
Problem Given n, how many structurally unique BST’s (binary search trees) that store values 1 … n? Example Solution class Solution {public:int numTrees(int n) {vector<int> dp(n+1,0);dp[0] =
Problem Oh, no! You have accidentally removed all spaces, punctuation, and capitalization in a lengthy document. A sentence like “I reset the computer. It still didn’t boot!” became "iresetthecompute
Problem A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to rea
Problem Given an input string (s) and a pattern §, implement wildcard pattern matching with support for ‘?’ and ‘*’. ‘?’ Matches any single character. ‘*’ Matches any sequence of characters (includ
Problem Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring. 来源:力扣(LeetCode) Example1 Input: “(()” Output: 2 Explan