自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

The Dream Of leozp

try my best

  • 博客(17)
  • 收藏
  • 关注

原创 Add Two Numbers

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link

2016-06-29 10:55:26 188

转载 KMP

1.首先,字符串"BBC ABCDAB ABCDABCDABDE"的第一个字符与搜索词"ABCDABD"的第一个字符,进行比较。因为B与A不匹配,所以搜索词后移一位。2.因为B与A不匹配,搜索词再往后移。3.就这样,直到字符串有一个字符,与搜索词的第一个字符相同为止。4.接着比较字符串和搜索词的下一个字符,还是相同。5.直到字符串有一个字符,与搜索词对应的字符不相同为止。6.这时,最自然的反应是,

2016-06-26 16:05:34 320

原创 Leetcode 1.Two Sum

暴力可过,复杂度达到了n^2 用map,复杂度为O(nlogn) //暴力版本 class Solution { public: vector twoSum(vector& nums, int target) { vectoranswer; for(int i=0;i<nums.size()-1;i++){ for(int j=i

2016-06-25 18:39:45 208

原创 Leetcode 202. Happy Number

202. Happy Number  My Submissions Question Editorial Solution Total Accepted: 75131 Total Submissions: 201741 Difficulty: Easy Write an algorithm to determine if a number is "happ

2016-06-25 17:44:08 243

原创 LeetCode 242. Valid Anagram

对俩个字符串各自扫一遍class Solution { public: bool isAnagram(string s, string t) { int len_s=s.length(); int len_t=t.length(); if(len_s!=len_t){ return false; }

2016-06-19 10:13:11 185

原创 LeetCode 64. Minimum Path Sum

class Solution { public: int minPathSum(vector>& grid) { int n=grid.size(); int m=grid[0].size(); int dp[n+1][m+1]; memset(dp,0,sizeof(dp)); dp[0][0]=grid[0

2016-06-18 20:48:11 182

原创 LeetCode 63. Unique Paths II

class Solution { public: int uniquePathsWithObstacles(vector>& obstacleGrid) { if(obstacleGrid.size()==0){ return 0; } int n=obstacleGrid.size(); int m=

2016-06-18 20:25:05 192

原创 LeetCode 62. Unique Paths

class Solution { public: int nn,mm; int uniquePaths(int m, int n) { num=0; nn=m,mm=n; int dp[101][101]; for(int i=0;i<n;i++){ dp[0][i]=1;

2016-06-18 20:07:20 174

原创 334. Increasing Triplet Subsequence

//贪心 class Solution { public: bool increasingTriplet(vector& nums) { int length=nums.size(); if(length==0){ return 0; } int cont=0; int dp[length+1]; dp[++cont]

2016-06-17 21:17:28 244

原创 300 Longest Increasing Subsequence

class Solution { public: int lengthOfLIS(vector& nums) { int length=nums.size(); if(length==0){ return 0; } int cont=0; int dp[length+1]; dp[++cont]=nums[0];

2016-06-17 21:13:11 209

原创 全排列

全排列的应用很广,比如路径全部输出 以前一直用递归写的全排列,今天发现可以用C++ STL 实现 //递归方法 #include #include #include using namespace std; char a[10]; int n; void fuck(char *b,int k) { if(k>=n-1){ for(int i=0;i<n;i++)

2016-06-16 16:04:00 257

原创 Python函数式练习

def calc_prod(lst): def prod(): def mul_(a,b): return a*b return reduce(mul_,lst) return prod f = calc_prod([1, 2, 3, 4]) print f()

2016-06-03 11:15:22 288

原创 设计模式07_装饰模式

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { abstract class Appearance { public

2016-06-02 17:06:00 256

原创 设计模式06_桥接模式

设计模式学习笔记_桥接模式 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 桥接_咖啡加糖 { abstract class Add_into_coffee {

2016-06-02 15:47:40 251

原创 设计模式05_抽象工厂模式

学习设计模式笔记之_抽象模式 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 抽象__汉堡可乐 { interface Hanbger { void buyha

2016-06-02 14:58:26 280

原创 Python__实现队列

Python__实现队列 class Queue(): def __init__(qu,size): qu.queue=[]; qu.size=size; qu.head=-1; qu.tail=-1; def Empty(qu): if qu.head==qu.tail: r

2016-06-01 23:29:57 244

原创 Python 实现栈

Python实现 栈操作

2016-06-01 23:15:58 314

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除