• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
yanqi
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理
上一页 1 2 3 4 5 下一页

2015年11月25日

LeetCode() Repeated DNA Sequences 看的非常的过瘾!
摘要: All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to ... 阅读全文
posted @ 2015-11-25 21:29 yanqi 阅读(145) 评论(0) 推荐(0)
 
 

2015年11月24日

LeetCode()Substring with Concatenation of All Words 为什么我的超时呢?找不到原因了!!!
摘要: 超时代码class Solution {public: vector findSubstring(string s, vector& words) { map coll; for(auto i:words) coll[i]++; ... 阅读全文
posted @ 2015-11-24 23:04 yanqi 阅读(154) 评论(0) 推荐(0)
 
LeetCode() Valid Anagram 有问题!!!
摘要: 为什么第一个通过,第二个不行呢?class Solution {public: bool isAnagram(string s, string t) { if(s.size() != t.size()) return false; vector... 阅读全文
posted @ 2015-11-24 11:08 yanqi 阅读(106) 评论(0) 推荐(0)
 
LeetCode()Word Pattern
摘要: 为什么我的算法不对呢,ab 可以检测,但超过两个不同的,就不对了先写在这里,哪天有思路了再看看// LeetCode.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include#include#include#include#includeusing name... 阅读全文
posted @ 2015-11-24 08:48 yanqi 阅读(154) 评论(0) 推荐(0)
 
 

2015年11月22日

LeetCode()Group Anagrams
摘要: 改了又改,简化了又简化,还是超时。可见必须从数组本身来进行hash运算。class Solution {public: vector> groupAnagrams(vector& strs) { vector> res; int flag=0; for... 阅读全文
posted @ 2015-11-22 22:09 yanqi 阅读(134) 评论(0) 推荐(0)
 
 

2015年11月20日

LeetCode() Different Ways to Add Parentheses
摘要: 分治的思想:1分2治3合并解这题最难的就是要想到 在运算符上分开。分治和递归是双胞胎啊!想不到啊想不到,不能再放纵自己了,眼睛干涩。vector diffWaysToCompute(string input) { vector result; for (int i = 0... 阅读全文
posted @ 2015-11-20 18:18 yanqi 阅读(130) 评论(0) 推荐(0)
 
 

2015年11月19日

LeetCode() Minimun Size Subarray Sum
摘要: 别人的代码class Solution {public: int minSubArrayLen(int s, vector& nums) { int l, r, cum, res = nums.size()+1; l = r = cum = 0; while ((u... 阅读全文
posted @ 2015-11-19 22:43 yanqi 阅读(183) 评论(0) 推荐(0)
 
LeetCode() First Missing Positive
摘要: 非常内疚,没想到这样的思路。思路:把数组上某一个位置的值放到正确的地方上去(nums[i-1] == i),nums[i] >0 && & A) { int i = 0; int n=A.size(); for (; i n || A[i] == A[A[i]... 阅读全文
posted @ 2015-11-19 19:27 yanqi 阅读(121) 评论(0) 推荐(0)
 
LeetCode() Find the Duplicate Number
摘要: Given an arraynumscontainingn+ 1 integers where each integer is between 1 andn(inclusive), prove that at least one duplicate number must exist. Assume... 阅读全文
posted @ 2015-11-19 13:43 yanqi 阅读(197) 评论(0) 推荐(0)
 
 

2015年11月18日

LeetCode() Search in Rotated Sorted Array
摘要: 思路:先找到断点。估计还有更快的,不知道为什么,实在是不愿意去想这道题了class Solution {public: int search(vector& nums, int target) { int i,index=0; for(i=1;i=n... 阅读全文
posted @ 2015-11-18 14:54 yanqi 阅读(130) 评论(0) 推荐(0)
 
 
上一页 1 2 3 4 5 下一页

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3