摘要:
You are given a binary tree (not necessarily BST) in which each node contains a value. Design an algorithm to print all paths which sum up to that val 阅读全文
posted @ 2016-02-04 12:02
neverlandly
阅读(618)
评论(0)
推荐(0)
摘要:
题目是遇到偶数/2,遇到奇数 *3 + 1的题目,然后找一个range内所有数字的max cycle length。对于一个数字,比如说44,按照题目的公式不停计算,过程是 44, 22, 11, 8, 9 ,1(瞎起的),从44到1的这个sequence的长度,叫做cycle length。然后题 阅读全文
posted @ 2016-02-04 05:21
neverlandly
阅读(596)
评论(0)
推荐(0)
摘要:
首先是如何sort一个只有0和1的数组,要求inplace. follow up是告诉一个range,如何在O(N)时间内sort好 两个pointer可解 1 package Sorting; 2 import java.util.*; 3 4 public class InplaceSortin 阅读全文
posted @ 2016-02-04 01:27
neverlandly
阅读(372)
评论(0)
推荐(0)
浙公网安备 33010602011771号