摘要: 题目:Given an array of integers, every element appearstwiceexcept for one. Find that single one.解法一: bit manipulate1 public class Solution {2 public... 阅读全文
posted @ 2015-07-29 23:44 Hygeia 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 题目: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... 阅读全文
posted @ 2015-07-29 23:28 Hygeia 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an integer, write a function to determine if it is a power of two. bn is the product of multiplying n bases: In that case, bn is called the  阅读全文
posted @ 2015-07-29 23:17 Hygeia 阅读(157) 评论(3) 推荐(0) 编辑
摘要: 题目:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), retu... 阅读全文
posted @ 2015-07-29 22:51 Hygeia 阅读(110) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2015-07-27 11:01 Hygeia 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 题目:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?解题思路:In-place So... 阅读全文
posted @ 2015-07-16 21:30 Hygeia 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 题目:Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted fro... 阅读全文
posted @ 2015-07-16 16:42 Hygeia 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 题目:After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. Thi... 阅读全文
posted @ 2015-07-15 11:34 Hygeia 阅读(207) 评论(0) 推荐(0) 编辑
摘要: reference: http://www.eecs.yorku.ca/course_archive/2013-14/W/2011/lectures/09%20Loop%20Invariants%20and%20Binary%20Search.pdf 阅读全文
posted @ 2015-07-14 17:31 Hygeia 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space 阅读全文
posted @ 2015-07-14 15:36 Hygeia 阅读(152) 评论(0) 推荐(0) 编辑