LeetCode
Purple_dandelion
这个作者很懒,什么都没留下…
展开
-
[LeetCode] Guess Number Higher or Lower
We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I’ll tell you whether the number is higher or lowe原创 2016-07-13 21:51:33 · 243 阅读 · 0 评论 -
[LeetCode]198. House Robber
问题: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent原创 2016-12-01 10:23:37 · 206 阅读 · 0 评论 -
[LeetCode]191. Number of 1 Bits
问题: Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight). For example, the 32-bit integer ’11’ has binary representation原创 2016-12-01 09:39:33 · 253 阅读 · 0 评论 -
[LeetCode]190. Reverse Bits
题目: Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00原创 2016-12-01 09:24:44 · 237 阅读 · 0 评论 -
[LeetCode]3. Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. Examples: Given “abcabcbb”, the answer is “abc”, which the length is 3. Given “bbbbb”, the answe原创 2016-09-24 09:38:51 · 189 阅读 · 0 评论 -
[LeetCode]2. 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 i原创 2016-09-23 15:56:25 · 164 阅读 · 0 评论 -
[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原创 2016-07-15 10:21:06 · 239 阅读 · 1 评论 -
[LeetCode]Add Binary
Given two binary strings, return their sum (also a binary string). For example, a = “11” b = “1” Return “100”.class Solution {public: string addBinary(string a, string b) { auto aIter原创 2016-07-14 21:23:11 · 227 阅读 · 0 评论 -
[LeetCode]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.class Solution {public: int getSum(int a, int b) {原创 2016-07-14 11:26:45 · 191 阅读 · 0 评论 -
[LeetCode]437. Path Sum III
题目: You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need to start or end at the root or a leaf,原创 2016-12-13 09:49:52 · 365 阅读 · 0 评论