摘要: 题目:You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl... 阅读全文
posted @ 2015-10-08 09:49 savageclc26 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 题目:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. ... 阅读全文
posted @ 2015-10-07 17:54 savageclc26 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 题目Given an array containingndistinct numbers taken from0, 1, 2, ..., n, find the one that is missing from the array.For example,Givennums=[0, 1, 3]ret... 阅读全文
posted @ 2015-10-07 11:07 savageclc26 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 题目:思路1:遍历参考的字符S,从中取出一个字符在需要检查的字符T中,使用indexof来得出位置如果结果为-1 则直接返回false如果结果为1,则将该字符从T中删除代码: public static boolean isAnagram(String s, String t) { ... 阅读全文
posted @ 2015-10-06 13:29 savageclc26 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, r... 阅读全文
posted @ 2015-10-06 09:22 savageclc26 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in... 阅读全文
posted @ 2015-10-02 21:13 savageclc26 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 题目:Given two stringssandt, write a function to determine iftis an anagram ofs.For example,s= "anagram",t= "nagaram", return true.s= "rat",t= "car", re... 阅读全文
posted @ 2015-09-30 22:44 savageclc26 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].S... 阅读全文
posted @ 2015-09-30 08:20 savageclc26 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.For example, giv... 阅读全文
posted @ 2015-09-21 22:22 savageclc26 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?思路:正常的遍历,使用HashSet来判断是否重复代码: public ... 阅读全文
posted @ 2015-09-17 10:46 savageclc26 阅读(104) 评论(0) 推荐(0) 编辑