随笔分类 - Java Practice
摘要:问答题: 在某射击场有N个靶,每个靶上都有一个分数,存在score数组中。击中第i个靶的得分为score[left] * score[i] * score[right],同时原left和right两个靶变为相邻的靶。其中得分为0的靶是不能射击的,当left不存在或者不能射击时,得分为 score[i
阅读全文
摘要:问题:实现 int sqrt(int x). 这里给出两种实现方法:一是二分搜索,二是牛顿迭代法。 二分搜索 牛顿迭代法 此外,如果返回值不是整型 参考:http://www.cnblogs.com/AnnieKim/archive/2013/04/18/3028607.html
阅读全文
摘要: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.
阅读全文
摘要:Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.
阅读全文

浙公网安备 33010602011771号