Given a digit string excluded 01, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. 样例 给定 “
因为数据有重复所以回溯法会给出重复的结果,需要set去重复。 class Solution {public:/*** @param nums: an integer array* @return: all the different possible increasing subsequences of the given array*/set<vector<int>> judge;vecto
情况特殊,考虑逻辑即可 class Solution {public:/*** @param n: An integer* @param str: a string with number from 1-n in random order and miss one number* @return: An integer*/int findMissing2(int n, string &str)
一、遍历每个点,每个点来一次dfs,结果超时 class Solution {public:/*** @param matrix: the given matrix* @return: The list of grid coordinates*/vector<vector<int>> globalans;vector<vector<int>> pacificAtlantic(vector<ve
代码一、使用递归算法,超时 class Solution {public:/** @param s: A string* @param dict: A dictionary of words dict* @return: A boolean*/bool wordBreak(string &s, unordered_set<string> &dict) {// write your code h
Description Ugly number is a number that only have factors 2, 3 and 5. Design an algorithm to find the nth ugly number. The first 10 ugly numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12... 利用动态规划的思想 de