• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
ying_vincent
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 27 下一页
2013年4月22日
LeetCode: Unique Paths
摘要: 一次过 1 class Solution { 2 public: 3 int uniquePaths(int m, int n) { 4 // Start typing your C/C++ solution below 5 // DO NOT write i... 阅读全文
posted @ 2013-04-22 11:54 ying_vincent 阅读(117) 评论(0) 推荐(0)
LeetCode: Unique Binary Search Trees II
摘要: 贴下自己写的不用指针的代码,更加容易懂吧 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right;... 阅读全文
posted @ 2013-04-22 11:12 ying_vincent 阅读(155) 评论(0) 推荐(0)
LeetCode: Unique Binary Search Trees
摘要: 有经验了,一上来就知道用dp, 一次过 1 class Solution { 2 public: 3 int numTrees(int n) { 4 // Start typing your C/C++ solution below 5 // DO NOT w... 阅读全文
posted @ 2013-04-22 08:19 ying_vincent 阅读(139) 评论(0) 推荐(0)
LeetCode: Two Sum
摘要: 坑爹的多数次过。。 1 class Solution { 2 public: 3 vector twoSum(vector &numbers, int target) { 4 // Start typing your C/C++ solution below 5 ... 阅读全文
posted @ 2013-04-22 08:10 ying_vincent 阅读(257) 评论(0) 推荐(0)
LeetCode: Triangle
摘要: 基本一次过 1 class Solution { 2 public: 3 int minimumTotal(vector<vector<int> > &triangle) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 if (!triangle.size()) return 0; 7 if (triangle.size() == 1) return triangle[0][0]; 8 ... 阅读全文
posted @ 2013-04-22 07:52 ying_vincent 阅读(134) 评论(0) 推荐(0)
LeetCode: Trapping Rain Water
摘要: 继续不争气看网上答案。。 1 class Solution { 2 public: 3 int trap(int A[], int n) { 4 // Start typing your C/C++ solution below 5 // DO NOT wri... 阅读全文
posted @ 2013-04-22 07:22 ying_vincent 阅读(155) 评论(0) 推荐(0)
LeetCode: Text Justification
摘要: 越到后面越不给力了,这题又看了答案。。 1 class Solution { 2 public: 3 vector fullJustify(vector &words, int L) { 4 vector ans; 5 int cur = 0; 6 ... 阅读全文
posted @ 2013-04-22 06:41 ying_vincent 阅读(453) 评论(0) 推荐(0)
LeetCode: Symmetric Tree
摘要: 看了网上答案 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * Tree... 阅读全文
posted @ 2013-04-22 03:51 ying_vincent 阅读(157) 评论(0) 推荐(0)
LeetCode: Swap Nodes in Pairs
摘要: 一次过 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x),... 阅读全文
posted @ 2013-04-22 02:56 ying_vincent 阅读(136) 评论(0) 推荐(0)
LeetCode: Surrounded Regions
摘要: 看了网上答案,dfs 1 class Solution { 2 public: 3 void dfs(vector> &board, int x, int y) { 4 if (x = board.size() || y = board.size()) return; 5 ... 阅读全文
posted @ 2013-04-22 02:40 ying_vincent 阅读(174) 评论(0) 推荐(0)
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 27 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3