随笔分类 - 第三期Week2——DFS专题
摘要:1 class Solution 2 { 3 unordered_map<string,vector<char>> hash; 4 public: 5 bool pyramidTransition(string bottom, vector<string>& allowed) 6 { 7 for(a
阅读全文
摘要:1 /** 2 * // This is the interface that allows for creating nested lists. 3 * // You should not implement it, or speculate about its implementation 4
阅读全文
摘要:1 class Solution 2 { 3 public: 4 string decodeString(string s) 5 { 6 int len = s.size(); 7 int num = 0; 8 stack<int> numstack; 9 stack<string> strstac
阅读全文
摘要:1 class Solution 2 { 3 public: 4 vector<string> letterCasePermutation(string S) 5 { 6 vector<string> res; 7 backTracking(res,S,0); 8 return res; 9 } 1
阅读全文
摘要:1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : val(x),
阅读全文
摘要:C++。思路如下: 对于连续整数序列[left, right]中的一点i,若要生成以i为根节点的BST,则有如下规律: i左边的序列可以作为左子树结点,且左儿子可能有多个,所以有vector<TreeNode *> left_nodes = generate(left, i - 1);; i右边的序
阅读全文
摘要:1 class Solution 2 { 3 vector<string> res; 4 public: 5 vector<string> restoreIpAddresses(string s) 6 { 7 string ip;//满足条件的IP地址 8 helper(s, 0, ip); 9 r
阅读全文
摘要:1 class Solution 2 { 3 public: 4 int dir[4][4]={{-1,0},{1,0},{0,-1},{0,1}}; 5 6 bool exist(vector<vector<char>>& board, string word) 7 { 8 int m=board
阅读全文
摘要:1 //直接套模板 2 class Solution 3 { 4 vector<vector<int>> res; 5 void helper(vector<int>& nums, int start, vector<int>& out,int k) 6 { 7 if(k == out.size()
阅读全文

浙公网安备 33010602011771号