• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
ying_vincent
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 ··· 20 21 22 23 24 25 26 27 下一页
2013年4月1日
LeetCode: Jump Game
摘要: 少了一个 =, 两次过 1 class Solution { 2 public: 3 bool canJump(int A[], int n) { 4 // Start typing your C/C++ solution below 5 // DO NOT ... 阅读全文
posted @ 2013-04-01 15:51 ying_vincent 阅读(152) 评论(0) 推荐(0)
LeetCode: Interleaving String
摘要: 第一次dfs, 没过large, 马上想到dp, 一次过了 1 class Solution { 2 public: 3 bool isInterleave(string s1, string s2, string s3) { 4 // Start typing your C... 阅读全文
posted @ 2013-04-01 14:53 ying_vincent 阅读(172) 评论(0) 推荐(0)
LeetCode: Insert Interval
摘要: C++ 1 /** 2 * Definition for an interval. 3 * struct Interval { 4 * int start; 5 * int end; 6 * Interval() : start(0), end(0) {} 7 *... 阅读全文
posted @ 2013-04-01 13:03 ying_vincent 阅读(226) 评论(0) 推荐(0)
2013年3月21日
LeetCode: Implement strStr()
摘要: 可以用c的方法 1 class Solution { 2 public: 3 char *strStr(char *haystack, char *needle) { 4 // IMPORTANT: Please reset any member data you decla... 阅读全文
posted @ 2013-03-21 15:32 ying_vincent 阅读(140) 评论(0) 推荐(0)
LeetCode: Gray Code
摘要: 这种强烈找规律的题目基本面试面到就挂,看了网上答案 1 class Solution { 2 public: 3 vector grayCode(int n) { 4 // Start typing your C/C++ solution below 5 //... 阅读全文
posted @ 2013-03-21 14:54 ying_vincent 阅读(145) 评论(0) 推荐(0)
LeetCode: Generate Parentheses
摘要: 第一次memory exceed了,想复杂了,看了答案才知道只要函数系数多点就行了。。 1 class Solution { 2 public: 3 void dfs(int dep, int leftnum, int n, vector &ret, int leftnumtotal, st... 阅读全文
posted @ 2013-03-21 14:31 ying_vincent 阅读(129) 评论(0) 推荐(0)
LeetCode: Flatten Binary Tree to Linked List
摘要: 忘记加tmp->left = NULL了,少数次改 贴上另外一段 C# 1 /** 2 * Definition for a binary tree node. 3 * public class TreeNode { 4 * public int val; 5 * public TreeNode l 阅读全文
posted @ 2013-03-21 12:21 ying_vincent 阅读(145) 评论(0) 推荐(0)
LeetCode: First Missing Positive
摘要: 一开始有失误,发现如果外面定义了int ret, for循环里第一个条件为int ret = 1的话,这里的ret跟外面的ret不一样。少数次过 1 class Solution { 2 public: 3 int firstMissingPositive(int A[], int n) {... 阅读全文
posted @ 2013-03-21 11:02 ying_vincent 阅读(152) 评论(0) 推荐(0)
LeetCode: Edit Distance
摘要: 知道是dp,没弄出状态方程。。 1 class Solution { 2 public: 3 int minDistance(string word1, string word2) { 4 // Start typing your C/C++ solution below 5... 阅读全文
posted @ 2013-03-21 10:44 ying_vincent 阅读(132) 评论(0) 推荐(0)
2013年3月20日
LeetCode: Divide Two Integers
摘要: 很多bug还不清楚。。用了网上答案 1 class Solution { 2 public: 3 int divide(int dividend, int divisor) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 bool isnegtive = false; 7 int multiply = 0; 8 long long a = dividend; 9 lon... 阅读全文
posted @ 2013-03-20 21:34 ying_vincent 阅读(151) 评论(0) 推荐(0)
上一页 1 ··· 20 21 22 23 24 25 26 27 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3