摘要:
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 阅读全文
摘要:
递归代码简洁。 递归的缺点: 1.递归是函数调用自身,函数调用有时间和空间的消耗:每一次函数调用,都需要在内存栈中分配空间已保存参数,返回地址及临时变量,而且往栈里压入数据和弹出数据都需要时间。 2.递归中有很多计算都是重复的(对存在重叠子问题的情形),从而对性能带来很大影响。比如:计算佩波拉契数列 阅读全文
摘要:
"153. Find Minimum in Rotated Sorted Array" Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., might become ). Find the 阅读全文
摘要:
https://leetcode.com/problems/rotate list/ Given a list, rotate the list to the right by k places, where k is non negative. For example: Given and k = 阅读全文