摘要:
这道题我觉得难点就是在到底咋用java判断一个数是不是质数这个点上。 说实话这个我实在没啥点,我这个办法也是直接死背下来的,所以我也不会说原理。 关于isPrime()method里面那个for loop为啥step是2是因为我的loopcong3开始,3,5,7,9……这样是略过了所有偶数... 阅读全文
posted @ 2015-08-20 16:04
李小橘er
阅读(224)
评论(0)
推荐(0)
摘要:
Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is great... 阅读全文
posted @ 2015-08-20 14:02
李小橘er
阅读(150)
评论(0)
推荐(0)
摘要:
Given an integer, write a function to determine if it is a power of two. 这道题没啥难度。主要是搞清楚怎么来判断一个数是不是power of two。 最简单的方法就是一直除以2最后等于1。如果不能,那么都是false。 ... 阅读全文
posted @ 2015-08-20 12:51
李小橘er
阅读(182)
评论(0)
推荐(0)
摘要:
Given an integer array of sizen, find all elements that appear more than⌊ n/3 ⌋times. The algorithm should run in linear time and in O(1) space. 这道题就... 阅读全文
posted @ 2015-08-20 11:21
李小橘er
阅读(131)
评论(0)
推荐(0)
摘要:
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo... 阅读全文
posted @ 2015-08-20 09:52
李小橘er
阅读(172)
评论(0)
推荐(0)
浙公网安备 33010602011771号