- 博客(10)
- 收藏
- 关注
原创 LeetCode_167. Two Sum II - Input array is sorted
Given 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 should return indices of the two numbers suc
2017-01-31 21:31:39 322
转载 LeetCode_258. Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, r
2017-01-31 20:44:55 260
原创 LeetCode_371. Sum of Two Integers
371. Sum of Two Integers Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example: Given a = 1 and b = 2, return 3.解题思路:既然不能用内置的加减法,那就只能用位运算。 xor:可理解为不考
2017-01-31 17:48:19 255
原创 LeetCode_492. Construct the Rectangle
492. Construct the Rectangle For 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 rectang
2017-01-30 11:46:25 843
原创 LeetCode_292. Nim Game
292. Nim Game You 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 sto
2017-01-30 10:53:29 302
原创 LeetCode_136. Single Number
136. Single Number Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it wi
2017-01-30 10:26:06 285
转载 LeetCode_463. Island Perimeter
463. Island Perimeter You 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). T
2017-01-28 20:50:11 275
原创 LeetCode_485. Max Consecutive Ones
485. Max Consecutive Ones Given a binary array, find the maxumum number of consecutive 1s in this array. Example 1Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last three di
2017-01-26 11:55:13 318
原创 LeetCode_344. Reverse String
344. Reverse String Write a function that takes a string as input and returns the string reversed.Example Given s=”hello”, return “olleh”. C++:class Solution{ public: string reverseString(string
2017-01-24 21:33:49 275
原创 LeetCode_476. Number Complement
476. Number ComplementGiven a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: 1. The given integer is guanteed to fit w
2017-01-24 17:17:13 633
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人