上一页 1 2 3 4 5 6 ··· 17 下一页

2014年3月11日

Median of Two Sorted Arrays

摘要: There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ... 阅读全文

posted @ 2014-03-11 20:17 waruzhi 阅读(258) 评论(0) 推荐(0) 编辑

LeetCode Question Difficulty Distribution

摘要: 参考链接:https://docs.google.com/spreadsheet/pub?key=0Aqt--%20wSNYfuxdGxQWVFsOGdVVWxQRlNUVXZTdEpOeEE&output=htmlIDQuestionDiffFreqData StructureAlgorithms1Two Sum25arraysortsetTwo Pointers2Add Two Numbers34linked listTwo PointersMath3Longest Substring Without Repeating Characters32stringTwo Pointers 阅读全文

posted @ 2014-03-11 11:04 waruzhi 阅读(298) 评论(0) 推荐(0) 编辑

2014年3月3日

宝洁面试经典八大问题(附答案范例)

摘要: 宝洁公司在中国高校招聘采用的面试评价测试方法主要是经历背景面谈法,即根据一些既定考察方面和问题来收集应聘者所提供的事例,从而来考核该应聘者的综合素质和能力。宝洁的面试由8个核心问题组成。宝洁公司招聘题号称由高级人力资源专家设计,无论您如实或编造回答, 都能反应您某一方面的能力。核心部分的题如下:Please provide concise examples that will help us better understand your capabilities.(1)Describe an instance where you set your sights on a high/dema.. 阅读全文

posted @ 2014-03-03 21:29 waruzhi 阅读(4549) 评论(0) 推荐(0) 编辑

2014年3月1日

做leetcode的几点体会分享(转)

摘要: 1 大部分题目你都是可以自己做出来的。所以,第一遍尽量不要网上找答案;2 写了的不管通过的,不通过的答案要保存下来。不通过的,也要记录下来哪儿没有通过。很有可能你这次错了,不知道怎么搞过了,下次还是错;3 一定要手写几遍,手写远远比在机器上印象深刻;4 写code的过程中要用最safe的写法写,不要写模棱两可的,编译器相关的表达方式,这样在面试过程中很容易露馅;5 code的风格保持一致。比如,不要题目这个用vector,那个用array,这个传size,那个不传,这个check null,那个不check,这个用new,那个用malloc,这个用const,那个用macro。争取做到所有题目 阅读全文

posted @ 2014-03-01 21:28 waruzhi 阅读(357) 评论(0) 推荐(0) 编辑

2014年2月17日

leetcode总结:permutations, permutations II, next permutation, permutation sequence

摘要: Next Permutation:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).The replacement must be in-place, do not allocat 阅读全文

posted @ 2014-02-17 10:25 waruzhi 阅读(461) 评论(0) 推荐(0) 编辑

2013年12月6日

Max Points on a Line

摘要: Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.思路:这道题的数据好像很弱,我只用了最普通的方法居然可以AC。对于每个点,求其他点到他连线的斜率,如果斜率相同,就表示在同一条直线上,用hash记录斜率和点的数目的关系。复杂度是O(n^2)的。最开始出错是因为没有考虑重复点的情况,加上这方面判断就AC了。代码: 1 int maxPoints(vector &points) { 2 int n = points.size(); ... 阅读全文

posted @ 2013-12-06 20:52 waruzhi 阅读(224) 评论(0) 推荐(0) 编辑

LRU Cache

摘要: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.set(key, value)- Set or insert the value if the key is not 阅读全文

posted @ 2013-12-06 19:42 waruzhi 阅读(226) 评论(0) 推荐(0) 编辑

2013年12月4日

Word Break II

摘要: Given a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example, givens="catsanddog",dict=["cat", "cats", "and", "sand", "dog"].A 阅读全文

posted @ 2013-12-04 20:47 waruzhi 阅读(233) 评论(0) 推荐(0) 编辑

Valid Number

摘要: Validate if a given string is numeric.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>trueNote:It is intended for the problem statement to be ambiguous. You should gather all requirements up front before implementin 阅读全文

posted @ 2013-12-04 17:14 waruzhi 阅读(215) 评论(0) 推荐(0) 编辑

Text Justification

摘要: Given an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) justified.You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces' 'when necessary so that each line 阅读全文

posted @ 2013-12-04 16:11 waruzhi 阅读(278) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 ··· 17 下一页

导航