LeetCode解题总结报告

string字符串

890. Find and Replace Pattern

You have a list of words and a pattern, and you want to know which words in words matches the pattern.
Input: words = [“abc”,”deq”,”mee”,”aqq”,”dkd”,”ccc”], pattern = “abb”
Output: [“mee”,”aqq”]
备注: 字符和数字转换,unordered_map

array数组

math数学

204. Count Primes

Count the number of prime numbers less than a non-negative number, n.
Input: 10
Output: 4
备注: 数学题,注意边界条件,vector标记count

递归

22. Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
备注: helper函数, string拼接, 递归生成vector; 递归终止条件是左括号和右括号剩余数目都=0是递归出口;逻辑:剩余(数>0则继续插入(;剩余)数>0 && 剩余(数>剩余)数, 才能继续插入)

dp动态规划