leetcode
文章平均质量分 66
zqkui
这个作者很懒,什么都没留下…
展开
-
leetcode之Move Zeroes
Given 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 calling you原创 2016-04-05 23:54:06 · 300 阅读 · 0 评论 -
leetcode之Number of 1 Bits
最近在学习LeetCode上的算法题目,今天做了一题。Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit integer ’11' has bi原创 2015-04-29 19:46:08 · 377 阅读 · 0 评论 -
leetcode之Range Sum Query - Immutab
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5) -> -1sumRan原创 2016-04-06 13:38:28 · 281 阅读 · 0 评论 -
leetcode之Power of Two
Given an integer, write a function to determine if it is a power of two.Credits:Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases.Subscribe to se原创 2016-04-07 01:15:53 · 224 阅读 · 0 评论 -
leetcode之Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element原创 2016-04-07 13:15:35 · 290 阅读 · 0 评论 -
Longest Repeating Character Replacement
Given a string that consists of only uppercase English letters, you can replace any letter in the string with another letter at most k times. Find the length of a longest substring containing all repe原创 2016-11-24 21:46:57 · 404 阅读 · 0 评论 -
Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:Given nums = [2,原创 2016-11-25 15:21:17 · 256 阅读 · 0 评论