06 2014 档案
LeetCode:Sudoku Solver && Valid Sudouku
摘要:其实数独还是我挺喜欢的一个游戏。原来有本数独的书。 其实Sudoku是基于Valid Sudouku.其实一开始有点想太多。基于平常玩数独的经验,有很多解数独的规则。貌似这个人为判断因素比较多。 而且一开始理解的valid是有解无解,其实这里要求的是给定的board里的数字是否符合规则,不一定能解。 其实我这里有3个函数,一个是判断行除该位置外是否有相同值的,一个是列,最后一个是小正方形里。... 阅读全文
posted @ 2014-06-12 15:53 JessiaDing 阅读(441) 评论(0) 推荐(0)
LeetCode:Search Insert Position
摘要: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 阅读(127) 评论(0) 推荐(0)
LeetCode:Search for a Range
摘要: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 阅读(170) 评论(0) 推荐(0)
LeetCode:Search in Rotated Sorted Array
摘要: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 阅读(172) 评论(0) 推荐(0)
LeetCode:Longest Valid Parentheses
摘要: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 阅读(116) 评论(0) 推荐(0)
LeetCode:Substring with Concatenation of All Words
摘要: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 阅读(146) 评论(0) 推荐(0)
LeetCode:Divide Two Integers
摘要:Divide two integers without using multiplication, division and mod operator. 其实刚开始看到这道题的时候,感觉应该是略简单。但真正开始写的时候发现了很多错误。 最开始的想法就是divisor一个一个加上去直到大于dividend为止,不过这样时间复杂度略高,是不会AC的。 后来的想法是每加一次,都把加数*2,这样可以... 阅读全文
posted @ 2014-06-06 14:46 JessiaDing 阅读(246) 评论(0) 推荐(0)
LeetCode:Remove Duplicates from Sorted Array && Remove Element
摘要: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 阅读(169) 评论(0) 推荐(0)
LeetCode:Reverse Nodes in k-Group
摘要:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is. ... 阅读全文
posted @ 2014-06-04 13:01 JessiaDing 阅读(110) 评论(0) 推荐(0)