自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

原创 Find the Duplicate Number

Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist....

2018-01-31 20:00:40

阅读数 65

评论数 0

原创 longest-palindromic-substring

Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longe...

2018-01-27 21:33:48

阅读数 28

评论数 0

原创 String to Integer (atoi)

题目描述 Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not se...

2018-01-27 15:46:03

阅读数 37

评论数 0

原创 Reverse Integer/palindrome-number

题目1:Reverse Integer Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to show spoilers. Have you...

2018-01-27 14:58:16

阅读数 54

评论数 0

原创 palindrome-number

Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. Some hints: Could negative integers be pa...

2018-01-27 13:28:13

阅读数 18

评论数 0

原创 remove-nth-node-from-end-of-list

Given a linked list, remove the n th node from the end of list and return its head. For example, Given linked list: 1->2->3-&g...

2018-01-23 16:50:51

阅读数 40

评论数 0

原创 reverse-nodes-in-k-group/swap-nodes-in-pairs

题目1:reverse-nodes-in-k-group Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nod...

2018-01-22 21:45:18

阅读数 60

评论数 0

原创 remove-element/remove-duplicates-from-sorted-array

题目1: Given an array and a value, remove all instances of that value in place and return the new length. The order of elements can be changed. It do...

2018-01-21 12:53:18

阅读数 32

评论数 0

原创 search-insert-position/search-for-a-range/search-in-rotated-sorted-array

题目一:search-insert-position(注意:返回的是low) Given a sorted array and a target value, return the index if the target is found. If not, return the index wh...

2018-01-21 11:28:10

阅读数 233

评论数 0

原创 sqrtx

Implementint sqrt(int x). Compute and return the square root of x. 代码如下: 方法一:二分法(把mid定义成int 类型,判断条件不能用mid*mid,会溢出) 注意:返回的时high int sqrt(int x) {...

2018-01-21 11:22:40

阅读数 247

评论数 0

原创 count_and_say

The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, … 1is read off as”one 1”or11. 11is read off ...

2018-01-21 10:49:39

阅读数 28

评论数 0

原创 while、for、++

以下代码都是等价的,假设s是vector,对s的每个元素都赋值为0for(int i=0;i<s.size();i++) s[i]=0;int i=-1; while(++i<s.size()) s[i]=0;int i=0; while(i<s.size()) ...

2018-01-20 15:55:03

阅读数 142

评论数 0

原创 strstr

Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack. 若函数原型是下面的形式,则代码如下: ...

2018-01-20 14:53:59

阅读数 421

评论数 0

原创 trapping-rain-water

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raini...

2018-01-19 14:56:59

阅读数 136

评论数 0

转载 Container With Most Water

Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoi...

2018-01-19 14:55:22

阅读数 35

评论数 0

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