自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

不积跬步无以至千里

不积跬步无以至千里

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

原创 Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined betwee

2015-07-24 15:11:13 347

原创 Path Sum

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ clas

2015-07-24 14:29:11 264

原创 Intersection of Two Linked Lists

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode *ge

2015-07-24 14:08:54 285

原创 two sum

Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, whe

2015-07-17 10:04:11 353

原创 Product of Array Except Self

For example, given [1,2,3,4], return [24,12,8,6].class Solution { public: vector productExceptSelf(vector& nums) { int zerocount=0; int multi=1; int zeroflag;

2015-07-16 10:57:43 416

原创 pow(double x,int n)

class Solution { public: double myPow(double x, int n) { if(n==0) return 1; if(n==1) return x; if(x==1) return 1; if(n>0){ if(n&1){ return myPow

2015-07-16 10:56:18 630

原创 斐波那契数列

第n项为n个{1,1,1,0}矩阵相乘结果的首项。#include using namespace std; typedef long long LL; const LL mod=1000000009; const int Q=2; struct matrix { LL a[Q][Q]; }; matrix base={1,1,1,0},one={1,0,0,1}; matrix m_mu

2015-07-15 08:46:48 371

原创 最大子序列和

#include using namespace std; int maxarray1(int* a,int n)///////// { int maxsum=0,thissum; for(int i=0;i<n;i++) { thissum=0; for(int j=0;j<n;j++) { thissum+=a[j]; if(thissum>maxsum)

2015-07-11 12:28:07 351

空空如也

空空如也

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

TA关注的人

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