最新 最热

Leetcode 168 Excel Sheet Column Title

Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z...

2018-01-12
1

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...

2018-01-12
1

Leetcode 190 Reverse Bits

Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176...

2018-01-12
1

Leetcode 219. Contains Duplicate II

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolut...

2018-01-12
1

Leetcode 231. Power of Two

Given an integer, write a function to determine if it is a power of two. 判断一个数是不是2的若干次幂?第一个想法,首个bit位为1,其余全为0.优美解法:只有2的若干次幂和自身减1的每一个bit位不同,所以n &(n-1) != 0 说明...

2018-01-12
0

Leetcode 228. Summary Ranges

Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. 给一个排序好的数组,将相......

2018-01-12
1

Leetcode 274. H-Index

Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. According to the ...

2018-01-12
1

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 + ...

2018-01-12
1

Leetcode 295. Find Median from Data Stream

Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle v...

2018-01-12
0

Leetcode 279. Perfect Squares

Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. For example, given n = 12, return...

2018-01-12
1