摘要: Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.【thought】Use two layers of loop to solve it.Do not st... 阅读全文
posted @ 2014-10-07 15:15 zhouyoulie 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ... 阅读全文
posted @ 2014-10-06 22:52 zhouyoulie 阅读(150) 评论(0) 推荐(0) 编辑
摘要: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ... 阅读全文
posted @ 2014-10-05 22:42 zhouyoulie 阅读(105) 评论(0) 推荐(0) 编辑
摘要: Given a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all such possibl... 阅读全文
posted @ 2014-10-05 16:29 zhouyoulie 阅读(131) 评论(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 @ 2014-10-04 23:10 zhouyoulie 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3->NULL. 1 /*... 阅读全文
posted @ 2014-10-03 16:28 zhouyoulie 阅读(161) 评论(0) 推荐(0) 编辑
摘要: Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321 1 #include 2 #include 3 #include 4 5 using namespace std; ... 阅读全文
posted @ 2014-10-03 14:23 zhouyoulie 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 写一个程序判断字符串A是否为其他两个字符串的组合,组合过程中其他两个字符串的相对顺序不能被破坏。 举例说明:abc和def可以组成字符串adebcf,但不能组成aefbcd,因为def的相对顺序已经被破坏。本题直接从string A入手loop配对即可,代码如下。 1 /***********... 阅读全文
posted @ 2014-09-10 16:44 zhouyoulie 阅读(152) 评论(0) 推荐(0) 编辑
摘要: It's still an Amazon interview question. Given an array containing only stars '*' and hashes '#' . Find longest contiguous sub array that will cont... 阅读全文
posted @ 2014-09-09 20:51 zhouyoulie 阅读(246) 评论(0) 推荐(0) 编辑
摘要: Amazon interview question: Given a 2-dimensional array with arbitrary sizes and contains random positive values, you are required to move from the ... 阅读全文
posted @ 2014-09-07 16:46 zhouyoulie 阅读(184) 评论(0) 推荐(0) 编辑