比特
文章平均质量分 74
jmspan
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode 268. Missing Number(缺失数字)
原题网址:https://leetcode.com/problems/missing-number/ Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given n原创 2016-04-11 02:15:40 · 1440 阅读 · 0 评论 -
LeetCode 461. Hamming Distance
原题网址:https://leetcode.com/problems/hamming-distance/ The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x原创 2016-12-20 03:54:53 · 796 阅读 · 0 评论 -
LeetCode 89. Gray Code(格雷码)
原题网址:https://leetcode.com/problems/gray-code/ The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total原创 2016-05-23 00:34:41 · 886 阅读 · 0 评论 -
LeetCode 67. Add Binary(二进制加)
原题网址:https://leetcode.com/problems/add-binary/ Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". 方法一:使用字符串来表示。 public class So原创 2016-05-22 00:04:55 · 662 阅读 · 0 评论 -
LeetCode 52. N-Queens II(N皇后)
原题网址:https://leetcode.com/problems/n-queens-ii/ Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. 方法一:深度优先搜索,使用一原创 2016-05-21 06:27:12 · 1010 阅读 · 0 评论 -
LeetCode 231. Power of Two(2的N次幂)
原题网址:https://leetcode.com/problems/power-of-two/ Given an integer, write a function to determine if it is a power of two. 思路:数字n是2的整数次幂,当且仅当n的二进制表示有且只有一个1。 public class Solution { public boo原创 2016-04-05 11:37:05 · 706 阅读 · 0 评论 -
LeetCode 342. Power of Four(4的n次幂)
原题网址:342. Power of Four 342. Power of Four 342. Power of Four 342. Power of Four Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num =原创 2016-04-30 11:08:01 · 496 阅读 · 0 评论 -
LeetCode 338. Counting Bits(统计比特数)
原题网址:https://leetcode.com/problems/counting-bits/ Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation原创 2016-04-30 08:16:39 · 721 阅读 · 0 评论 -
LeetCode 318. Maximum Product of Word Lengths(最大单词长度乘积)
原题网址:https://leetcode.com/problems/maximum-product-of-word-lengths/ Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share comm原创 2016-04-23 13:28:40 · 952 阅读 · 1 评论 -
LeetCode 307. Range Sum Query - Mutable(区间之和)
原题网址:https://leetcode.com/problems/range-sum-query-mutable/ Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The update(i, val) function mo原创 2016-04-20 07:58:00 · 701 阅读 · 0 评论 -
LeetCode 201. Bitwise AND of Numbers Range(范围内所有数值的比特与)
原题网址:https://leetcode.com/problems/bitwise-and-of-numbers-range/ Given a range [m, n] where 0 For example, given the range [5, 7], you should return 4. 思路:总体思路就是求出m和n的高位比特的公共前缀。 方法一:变动前缀本身。原创 2016-05-04 05:21:07 · 494 阅读 · 0 评论 -
LeetCode 191. Number of 1 Bits(比特数)
原题网址:https://leetcode.com/problems/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原创 2016-05-04 03:05:52 · 489 阅读 · 0 评论 -
LeetCode 190. Reverse Bits(翻转比特)
原题网址:https://leetcode.com/problems/reverse-bits/ Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100)原创 2016-05-04 02:49:15 · 1878 阅读 · 0 评论 -
LeetCode 136. Single Number(单个数字)
原题网址:https://leetcode.com/problems/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 runti原创 2016-05-27 00:22:39 · 451 阅读 · 0 评论 -
LeetCode 137. Single Number II(单个数字)
原题网址:https://leetcode.com/problems/single-number-ii/ Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a lin原创 2016-05-27 00:22:35 · 718 阅读 · 0 评论 -
LeetCode 260. Single Number III
原题网址:https://leetcode.com/problems/single-number-iii/ Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the tw原创 2016-04-09 15:46:39 · 543 阅读 · 0 评论 -
LeetCode 477. Total Hamming Distance
原题网址:https://leetcode.com/problems/total-hamming-distance/ The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Now your job is原创 2016-12-20 04:08:53 · 1098 阅读 · 0 评论
分享