• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
ying_vincent
博客园    首页    新随笔    联系   管理    订阅  订阅
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 阅读(146) 评论(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)
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3