摘要:
[抄题]: 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 3 阅读全文
posted @ 2018-03-13 22:16
苗妙苗
阅读(127)
评论(0)
推荐(0)
摘要:
[抄题]: The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, 阅读全文
posted @ 2018-03-13 21:48
苗妙苗
阅读(243)
评论(0)
推荐(0)
摘要:
[抄题]: Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime c 阅读全文
posted @ 2018-03-13 21:38
苗妙苗
阅读(139)
评论(0)
推荐(0)
摘要:
[抄题]: There is a fence with n posts, each post can be painted with one of the k colors. You have to paint all the posts such that no more than two adj 阅读全文
posted @ 2018-03-13 20:36
苗妙苗
阅读(273)
评论(0)
推荐(0)
摘要:
[抄题]: There are a row of n houses, each house can be painted with one of the three colors: red, blue or green. The cost of painting each house with a 阅读全文
posted @ 2018-03-13 15:41
苗妙苗
阅读(250)
评论(0)
推荐(0)
摘要:
[抄题]: On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two st 阅读全文
posted @ 2018-03-13 11:52
苗妙苗
阅读(141)
评论(0)
推荐(0)
摘要:
Immutable [抄题]: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: [暴力解法]: 时间分析:n 空间分析:n [ 阅读全文
posted @ 2018-03-13 10:09
苗妙苗
阅读(255)
评论(0)
推荐(0)