
hash table
yuccess
这个作者很懒,什么都没留下…
展开
-
37. Sudoku Solver : 代码的优化:从1865ms 到 489ms 到最后69ms AC
题目:Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution.初步思路:原创 2016-11-30 00:40:52 · 338 阅读 · 0 评论 -
36. Valid Sudoku, leetcode
题目:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partia原创 2016-11-26 15:14:09 · 210 阅读 · 0 评论 -
18. 4Sum
题目:Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: The原创 2016-11-25 23:45:39 · 260 阅读 · 0 评论 -
30. Substring with Concatenation of All Words, leetcode
题目:You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly原创 2016-11-25 23:40:36 · 301 阅读 · 0 评论 -
3. Longest Substring Without Repeating Characters, leetcode
题目:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the an原创 2016-11-24 23:41:55 · 233 阅读 · 0 评论 -
1. Two Sum, leetcode
题目:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:Given原创 2016-11-24 22:46:48 · 213 阅读 · 0 评论 -
149. Max Points on a Line
题目:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.总结:浪费了一个多小时, 总结,头脑不清醒的时候,就不要编代码了。休息十分钟,然后清醒的投入战斗。代码:/** * Definition for a point.原创 2016-12-05 01:18:53 · 220 阅读 · 0 评论 -
76. Minimum Window Substring, leetcode
题目:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum windo原创 2016-12-04 17:32:23 · 290 阅读 · 0 评论 -
49. Group Anagrams, leetcode
Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]Note: Al原创 2016-12-01 20:53:46 · 240 阅读 · 0 评论 -
15. 3Sum hash解法 vs 双指针解法
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not contain d原创 2017-01-05 00:45:30 · 1193 阅读 · 0 评论