上一页 1 2 3 4 5 6 7 8 ··· 22 下一页
摘要: Given an array of integers, find out whether there are two distinct indicesiandjin the array such that the difference betweennums[i]andnums[j]is at mo... 阅读全文
posted @ 2015-06-13 00:48 世界到处都是小星星 阅读(1616) 评论(0) 推荐(0) 编辑
摘要: Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired bythis... 阅读全文
posted @ 2015-06-12 23:50 世界到处都是小星星 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 还有2个queue做,没写class MyStack { public Queue q = new LinkedList(); //cc150的问题,好像 // single queue public void push(int x) { q.add((int)... 阅读全文
posted @ 2015-06-12 09:50 世界到处都是小星星 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl... 阅读全文
posted @ 2015-06-12 08:44 世界到处都是小星星 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 排排坐分果果,这道题还是蛮难想的,答案忘了从哪里看的了 public int candy(int[] ratings) { if(ratings == null) return 0; int len = ratings.length; int res ... 阅读全文
posted @ 2015-06-12 06:45 世界到处都是小星星 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 我觉得这道题是dp比较有趣的应用吧,但是老用不熟sigh一下public class Solution { public int canCompleteCircuit(int[] gas, int[] cost) { int total=0, curRem=0, curSum=0... 阅读全文
posted @ 2015-06-12 05:57 世界到处都是小星星 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 典型的dfs,做个hashmap判断是否存过(oldnode,newnode)最后怎么把neighbor加入到hm对应node的neighbor list中比较关键public class Solution { public UndirectedGraphNode cloneGraph(Und... 阅读全文
posted @ 2015-06-12 04:34 世界到处都是小星星 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs... 阅读全文
posted @ 2015-06-11 13:25 世界到处都是小星星 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 正常dfspublic class Solution { public ArrayList> partition(String s) { ArrayList> res = new ArrayList>(); if(s==null||s.length()==0) re... 阅读全文
posted @ 2015-06-11 11:30 世界到处都是小星星 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region... 阅读全文
posted @ 2015-06-11 06:29 世界到处都是小星星 阅读(269) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 22 下一页