• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
ying_vincent
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 27 下一页
2013年4月19日
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 阅读(146) 评论(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 阅读(133) 评论(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 阅读(150) 评论(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 阅读(149) 评论(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 阅读(150) 评论(0) 推荐(0)
2013年4月10日
LeetCode: Next Permutation
摘要: 思路还是清楚的,从后面倒着数,中间有一些问题没考虑到,不过很快解决,少数次过 1 class Solution { 2 public: 3 void nextPermutation(vector &num) { 4 // Start typing your C/C++ sol... 阅读全文
posted @ 2013-04-10 13:02 ying_vincent 阅读(201) 评论(0) 推荐(0)
LeetCode: N-Queens II
摘要: 这道题其实我原来的思想是对的,不过不知道vector的速度要比数组慢很多,还有就是把参数放到private里也会减少运行时间。memset的时间和一个for循环是一样的,所以以后如果能确定一个数组的size并且不会改变数组大小的,就可以不用vector而用数组。多数次过 1 class Soluti... 阅读全文
posted @ 2013-04-10 12:11 ying_vincent 阅读(239) 评论(0) 推荐(0)
LeetCode: N-Queens
摘要: 很惊奇这题一次过了,不过我的code感觉比较冗长,建议看网上答案 1 class Solution { 2 public: 3 void dfs(vector &visit, vector &rec, vector> &ret, int dep, int n) { 4 if ... 阅读全文
posted @ 2013-04-10 09:17 ying_vincent 阅读(188) 评论(0) 推荐(0)
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 27 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3