自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

whl_program的博客

向程序猿迈进ing,个人网站www.whlong.cn

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

原创 [LeetCode]167. Two Sum II - Input array is sorted(输入两数和 II - 输出排序数组这两数位置)

167. Two Sum II - Input array is sortedGiven an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum shoul

2017-03-31 14:02:12 288

原创 [LeetCode]283. Move Zeroes(把0移到数组后面)

283. Move ZeroesGiven an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after ca

2017-03-29 20:57:47 484

原创 [LeetCode]492. Construct the Rectangle(构造矩形)

492. Construct the RectangleFor a web developer, it is very important to know how to design a web page’s size. So, given a specific rectangular web page’s area, your job by now is to design a rectangul

2017-03-29 20:03:13 315

原创 [LeetCode]226. Invert Binary Tree(反转二叉树)

226. Invert Binary TreeInvert a binary tree.翻转二叉树 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 用递归,交换各个节点的左右节点 代码如下:C++/** * Definition for a bin

2017-03-23 01:15:09 236

原创 [LeetCode]258. Add Digits(把数各个位上的数字相加)

258. Add DigitsGiven a non-negative integer num, repeatedly add all its digits until the result has only one digit. 题目大意: 给定一个非负整数num,重复地添加所有其数字,直到结果只有一个数字。For example:Given num = 38, the process is

2017-03-15 00:37:47 812

原创 [LeetCode]389. Find the Difference(找不同)

389. Find the DifferenceGiven two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find t

2017-03-12 18:15:29 529

原创 [LeetCode]371. Sum of Two Integers(不使用+-运算符求和)

371. Sum of Two IntegersCalculate the sum of two integers a and b, but you are not allowed to use the operator + and -. 计算两个整数a和b的和,但不允许使用运算符+和 - 。 Example: Given a = 1 and b = 2, return 3. 思路: 异或的一个

2017-03-10 01:24:37 271

原创 [LeetCode]104. Maximum Depth of Binary Tree(二叉树最大深度)

104. Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. 题目大意: 给

2017-03-08 23:48:06 307

原创 [LeetCode]448. Find All Numbers Disappeared in an Array(查找数组中消失的所有数字)

448. Find All Numbers Disappeared in an ArrayGiven an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclu

2017-03-08 21:03:22 414

原创 [LeetCode]136. Single Number(找出数组中单独出现的数)

136. Single NumberGiven an array of integers, every element appears twice except for one. Find that single one. 题目大意:给定一个整数数组,每个元素出现两次,只要一个元素出现一次。 找到这个元素。 Note: Your algorithm should have a linear r

2017-03-08 13:00:28 322

原创 [LeetCode]520. Detect Capital(检测单词是否合法)

520. Detect CapitalGiven a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of the following cases holds: -

2017-03-08 10:29:01 526

原创 [LeetCode]292. Nim Game(轮流拿掉石头)

292. Nim GameYou are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone

2017-03-08 09:18:39 868

原创 [LeetCode]485. Max Consecutive Ones(最大连续为1的数量)

485. Max Consecutive OnesGiven a binary array, find the maximum number of consecutive 1s in this array. 题目大意:给一个二进制数组,找到连续为1的最大数量 Example 1:Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two di

2017-03-01 01:51:19 494

原创 [LeetCode]463. Island Perimeter(岛周长)

463. Island PerimeterYou are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The

2017-03-01 01:05:18 374

原创 [LeetCode]344. Reverse String(反转字符串)

344. Reverse StringWrite a function that takes a string as input and returns the string reversed. 题目大意:反向输出字符串 Example:Given s = "hello", return "olleh".代码如下C++class Solution { public: string reve

2017-03-01 00:52:37 676

空空如也

空空如也

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

TA关注的人

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