摘要:
power of two http://www.cnblogs.com/-1307/p/6907811.html Add Digits https://leetcode.com/problems/add-digits/#/solutions 各位数相加 0 1 2 3 4 5 6 7 8 9 10 阅读全文
摘要:
Details Basics At the heart of bit manipulation are the bit-wise operators & (and), | (or), ~ (not) and ^ (exclusive-or, xor) and shift operators a << 阅读全文
摘要:
Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of 阅读全文
摘要:
https://leetcode.com/problems/next-greater-element-i/#/description You are given two arrays (without duplicates) nums1 and nums2 where nums1’s element 阅读全文
摘要:
In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. 阅读全文
摘要:
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: Example 1: Exa 阅读全文
摘要:
判断一个整数是不是2的幂。 关键是弄明白2的幂的二进制形式只有一个1。 相似题:判断一个数是不是3的幂。 方法一:循环 方法二:转3进制 10进制,1(100)、10(101)、100(102)……; 2进制,1(20)、10(21)、100(22)……; 3进制,1(30)、10(31)、100( 阅读全文
摘要:
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. 阅读全文
摘要:
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 nums = [0, 1, 阅读全文
摘要:
翻转32位无符号二进制整数 Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010 阅读全文