摘要: Description:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Code: 1 bool hasCycle(ListNo... 阅读全文
posted @ 2015-06-21 17:27 Rosanne 阅读(194) 评论(0) 推荐(0)
摘要: Description:Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary word... 阅读全文
posted @ 2015-06-21 17:23 Rosanne 阅读(236) 评论(0) 推荐(0)
摘要: Dscription:Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear r... 阅读全文
posted @ 2015-06-21 17:14 Rosanne 阅读(189) 评论(0) 推荐(0)
摘要: Description:Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtim... 阅读全文
posted @ 2015-06-21 16:58 Rosanne 阅读(158) 评论(0) 推荐(0)
摘要: Description: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 surro... 阅读全文
posted @ 2015-06-21 16:46 Rosanne 阅读(194) 评论(0) 推荐(0)
摘要: Description:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a... 阅读全文
posted @ 2015-06-21 16:27 Rosanne 阅读(189) 评论(0) 推荐(0)
摘要: Description:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, g... 阅读全文
posted @ 2015-06-20 16:25 Rosanne 阅读(235) 评论(0) 推荐(0)
摘要: Description:Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm t... 阅读全文
posted @ 2015-06-20 16:19 Rosanne 阅读(183) 评论(0) 推荐(0)
摘要: Description:GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1],... 阅读全文
posted @ 2015-06-20 16:17 Rosanne 阅读(216) 评论(0) 推荐(0)
摘要: Description:Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous s... 阅读全文
posted @ 2015-06-20 15:49 Rosanne 阅读(199) 评论(0) 推荐(0)