• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
ying_vincent
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 ··· 19 20 21 22 23 24 25 26 27 下一页
2013年4月8日
LeetCode: Maximum Depth of Binary Tree
摘要: 一次过,超简单 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * Tre... 阅读全文
posted @ 2013-04-08 00:07 ying_vincent 阅读(134) 评论(0) 推荐(0)
2013年4月5日
LeetCode: Longest Valid Parentheses
摘要: 用dfs large超时,看了网上答案用stack,其实一开始也想到了,只是没预料到stack比dfs更优越 1 class Solution { 2 public: 3 struct node { 4 char c; 5 int index; 6 ... 阅读全文
posted @ 2013-04-05 03:41 ying_vincent 阅读(362) 评论(0) 推荐(0)
2013年4月4日
LeetCode: Longest Substring Without Repeating Characters
摘要: 小失误,基本一次过 1 class Solution { 2 public: 3 int lengthOfLongestSubstring(string s) { 4 // Start typing your C/C++ solution below 5 //... 阅读全文
posted @ 2013-04-04 07:58 ying_vincent 阅读(152) 评论(0) 推荐(0)
LeetCode: Longest Palindromic Substring
摘要: 自己的large没过,找到的网上答案跟一开始的想法是一样的,不过被网上的一个string的substr用法给坑了。。string.substr(strposstart, length) 1 class Solution { 2 public: 3 string longestPalindro... 阅读全文
posted @ 2013-04-04 03:00 ying_vincent 阅读(230) 评论(0) 推荐(0)
2013年4月2日
LeetCode: Longest Consecutive Sequence
摘要: 想到map了,可惜没想到用erase来节省空间,看了网上答案 1 class Solution { 2 public: 3 int longestConsecutive(vector &num) { 4 // Start typing your C/C++ solution ... 阅读全文
posted @ 2013-04-02 17:27 ying_vincent 阅读(230) 评论(0) 推荐(0)
LeetCode: Longest Common Prefix
摘要: string.erase没掌握好,悲了个剧,2次过 1 class Solution { 2 public: 3 string longestCommonPrefix(vector &strs) { 4 // Start typing your C/C++ solution ... 阅读全文
posted @ 2013-04-02 15:56 ying_vincent 阅读(205) 评论(0) 推荐(0)
LeetCode: "Letter Combinations of a Phone Number
摘要: 一些小问题, “”的输出我的是[], 但是答案却是[""], 比较难理解,3次过 1 class Solution { 2 public: 3 void dfs(vector &ret, string tmp, map refer, string digits, int beg) { 4 ... 阅读全文
posted @ 2013-04-02 15:44 ying_vincent 阅读(175) 评论(0) 推荐(0)
LeetCode: Length of Last Word
摘要: 初始length的时候忘给了0了,2次过 1 class Solution { 2 public: 3 int lengthOfLastWord(const char *s) { 4 // Start typing your C/C++ solution below 5 ... 阅读全文
posted @ 2013-04-02 15:19 ying_vincent 阅读(154) 评论(0) 推荐(0)
LeetCode: Largest Rectangle in Histogram
摘要: 没想出来,看了网上答案再改了改 1 class Solution { 2 public: 3 struct node { 4 int left; 5 int right; 6 }; 7 int largestRectangleArea(vect... 阅读全文
posted @ 2013-04-02 05:11 ying_vincent 阅读(241) 评论(0) 推荐(0)
2013年4月1日
LeetCode: Jump Game II
摘要: 第一次给每个值都算最远距离,结果large没过,第二次用了现在的方法稍微改了改,最后过了,少数次过吧 1 class Solution { 2 public: 3 int jump(int A[], int n) { 4 // Start typing your C/C++ ... 阅读全文
posted @ 2013-04-01 18:09 ying_vincent 阅读(171) 评论(0) 推荐(0)
上一页 1 ··· 19 20 21 22 23 24 25 26 27 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3