• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
ying_vincent
博客园    首页    新随笔    联系   管理    订阅  订阅
2013年4月19日
LeetCode: Pow(x, n)
摘要: 早早投降了,看了这个强大的代码 1 class Solution { 2 public: 3 double pow(double x, int n) { 4 // Start typing your C/C++ solution below 5 // DO N... 阅读全文
posted @ 2013-04-19 15:41 ying_vincent 阅读(177) 评论(0) 推荐(0)
LeetCode: Populating Next Right Pointers in Each Node II
摘要: 这题关键是要记录下一层第一个节点 1 /** 2 * Definition for binary tree with next pointer. 3 * struct TreeLinkNode { 4 * int val; 5 * TreeLinkNode *left, *right, ... 阅读全文
posted @ 2013-04-19 14:48 ying_vincent 阅读(181) 评论(2) 推荐(0)
LeetCode: Populating Next Right Pointers in Each Node
摘要: 思路对的,少数次过,基本一次过吧 1 /** 2 * Definition for binary tree with next pointer. 3 * struct TreeLinkNode { 4 * int val; 5 * TreeLinkNode *left, *right, *next; 6 * TreeLinkNode(int x) : val(x), left(NULL), right(NULL), next(NULL) {} 7 * }; 8 */ 9 class Solution {10 public:11 void connect(TreeLi... 阅读全文
posted @ 2013-04-19 14:42 ying_vincent 阅读(132) 评论(0) 推荐(0)
LeetCode: Plus One
摘要: 考vector的insert操作,一次过 1 class Solution { 2 public: 3 vector plusOne(vector &digits) { 4 // Start typing your C/C++ solution below 5 ... 阅读全文
posted @ 2013-04-19 13:14 ying_vincent 阅读(144) 评论(0) 推荐(0)
LeetCode: Permutations II
摘要: 一些小失误,基本一次过,这题可以明显看到自己的进步,map用得比较成熟了 1 class Solution { 2 public: 3 void dfs(int dep, int maxdep, map &s, vector> &ret, vector &tmp) { 4 i... 阅读全文
posted @ 2013-04-19 13:07 ying_vincent 阅读(253) 评论(0) 推荐(0)
LeetCode: Permutations
摘要: 一次过 1 class Solution { 2 public: 3 void dfs(int dep, int maxdep, vector &tmp, vector> &ret, vector num, vector &visit) { 4 if (dep == maxd... 阅读全文
posted @ 2013-04-19 12:07 ying_vincent 阅读(188) 评论(0) 推荐(0)
LeetCode: Permutation Sequence
摘要: 这题的难度在编程,一开始想到的dfs过不了large,第二次想到网上的正确答案的思路,不过没有编出来,然后只好找答案了 1 class Solution { 2 public: 3 string getPermutation(int n, int k) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 string ret = ""; 7 int time = 1; 8 for (int... 阅读全文
posted @ 2013-04-19 11:37 ying_vincent 阅读(406) 评论(1) 推荐(0)
LeetCode: Path Sum II
摘要: 多数次过 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNo... 阅读全文
posted @ 2013-04-19 07:46 ying_vincent 阅读(124) 评论(0) 推荐(0)
LeetCode: Path Sum
摘要: 少数次过 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNo... 阅读全文
posted @ 2013-04-19 04:22 ying_vincent 阅读(146) 评论(0) 推荐(0)
LeetCode: Pascal's Triangle II
摘要: 小失误,基本一次过 1 class Solution { 2 public: 3 vector getRow(int rowIndex) { 4 // Start typing your C/C++ solution below 5 // DO NOT wri... 阅读全文
posted @ 2013-04-19 04:09 ying_vincent 阅读(148) 评论(0) 推荐(0)
LeetCode: Pascal's Triangle
摘要: 一点小失误,少数次过 1 class Solution { 2 public: 3 vector > generate(int numRows) { 4 // Start typing your C/C++ solution below 5 // DO NOT... 阅读全文
posted @ 2013-04-19 03:50 ying_vincent 阅读(134) 评论(0) 推荐(0)
LeetCode: Partition List
摘要: 一次过,链表题无难度 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : ... 阅读全文
posted @ 2013-04-19 03:36 ying_vincent 阅读(154) 评论(0) 推荐(0)
LeetCode: Palindrome Partitioning II
摘要: dfs large没过,看了网上的dp 1 class Solution { 2 public: 3 int minCut(string s) { 4 int n = s.size(); 5 vector C(n+1); 6 vector > ... 阅读全文
posted @ 2013-04-19 03:15 ying_vincent 阅读(150) 评论(0) 推荐(0)
LeetCode: Palindrome Partitioning
摘要: 一次过 1 class Solution { 2 public: 3 bool check(string s) { 4 for (int i = 0; i > &ret, vector &retin, string s, int beg, int size) {10 ... 阅读全文
posted @ 2013-04-19 02:34 ying_vincent 阅读(134) 评论(0) 推荐(0)
LeetCode: Palindrome Number
摘要: 一点小失误,基本一次过吧 1 class Solution { 2 public: 3 bool isPalindrome(int x) { 4 // Start typing your C/C++ solution below 5 // DO NOT wri... 阅读全文
posted @ 2013-04-19 02:16 ying_vincent 阅读(151) 评论(0) 推荐(0)
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3