随笔分类 -  Java Practice

摘要:问答题: 在某射击场有N个靶,每个靶上都有一个分数,存在score数组中。击中第i个靶的得分为score[left] * score[i] * score[right],同时原left和right两个靶变为相邻的靶。其中得分为0的靶是不能射击的,当left不存在或者不能射击时,得分为 score[i 阅读全文
posted @ 2017-08-19 16:33 MazeHong 阅读(644) 评论(0) 推荐(0)
摘要:问题:实现 int sqrt(int x). 这里给出两种实现方法:一是二分搜索,二是牛顿迭代法。 二分搜索 牛顿迭代法 此外,如果返回值不是整型 参考:http://www.cnblogs.com/AnnieKim/archive/2013/04/18/3028607.html 阅读全文
posted @ 2017-08-10 10:32 MazeHong 阅读(223) 评论(0) 推荐(0)
摘要:Given
 an 
arbitrary
 ransom
 note
 string 
and 
another 
string 
containing 
letters from
 all 
the 
magazines,
 write 
a 
function 
that 
will 
return 
true 
if 
the 
ransom 
 note 
can 
be 
constructed 
from 
the 
magazines ; 
otherwise, 
it 
will 
return 
false. 阅读全文
posted @ 2016-08-25 10:42 MazeHong 阅读(283) 评论(0) 推荐(0)
摘要:Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. 阅读全文
posted @ 2016-08-24 20:03 MazeHong 阅读(158) 评论(0) 推荐(0)
摘要:Integer类的一部分测试 阅读全文
posted @ 2016-08-22 10:06 MazeHong 阅读(238) 评论(0) 推荐(0)