2014年7月11日
摘要: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each number in C may only be used once in the combination... 阅读全文
posted @ 2014-07-11 10:58 JessiaDing 阅读(146) 评论(0) 推荐(0) 编辑
  2014年7月10日
摘要: 因为实验室项目好久没刷题了。从今天开始重新开始刷题。 Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be chos... 阅读全文
posted @ 2014-07-10 11:22 JessiaDing 阅读(191) 评论(0) 推荐(0) 编辑
  2014年6月12日
摘要: 其实数独还是我挺喜欢的一个游戏。原来有本数独的书。 其实Sudoku是基于Valid Sudouku.其实一开始有点想太多。基于平常玩数独的经验,有很多解数独的规则。貌似这个人为判断因素比较多。 而且一开始理解的valid是有解无解,其实这里要求的是给定的board里的数字是否符合规则,不一定能解。 其实我这里有3个函数,一个是判断行除该位置外是否有相同值的,一个是列,最后一个是小正方形里。... 阅读全文
posted @ 2014-06-12 15:53 JessiaDing 阅读(429) 评论(0) 推荐(0) 编辑
  2014年6月10日
摘要: 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 order. You may assume no duplicates in the array. ... 阅读全文
posted @ 2014-06-10 14:49 JessiaDing 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in t... 阅读全文
posted @ 2014-06-10 14:33 JessiaDing 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target value to search. If found in the array return its ... 阅读全文
posted @ 2014-06-10 14:06 JessiaDing 阅读(163) 评论(0) 推荐(0) 编辑
  2014年6月9日
摘要: Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the longest valid parentheses substring is "()", which ... 阅读全文
posted @ 2014-06-09 16:52 JessiaDing 阅读(103) 评论(0) 推荐(0) 编辑
摘要: You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without an... 阅读全文
posted @ 2014-06-09 11:35 JessiaDing 阅读(138) 评论(0) 推荐(0) 编辑
  2014年6月6日
摘要: Divide two integers without using multiplication, division and mod operator. 其实刚开始看到这道题的时候,感觉应该是略简单。但真正开始写的时候发现了很多错误。 最开始的想法就是divisor一个一个加上去直到大于dividend为止,不过这样时间复杂度略高,是不会AC的。 后来的想法是每加一次,都把加数*2,这样可以... 阅读全文
posted @ 2014-06-06 14:46 JessiaDing 阅读(234) 评论(0) 推荐(0) 编辑
  2014年6月4日
摘要: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for... 阅读全文
posted @ 2014-06-04 13:39 JessiaDing 阅读(152) 评论(0) 推荐(0) 编辑