随笔分类 -  leetcode题解总结归类

本分类根据一些相似的题,难度由浅至深,或者是一些同一系列的问题。
摘要:问题描述: Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below. 阅读全文
posted @ 2017-04-13 09:25 SarahLiu77 阅读(422) 评论(0) 推荐(0)
摘要:A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represents 阅读全文
posted @ 2016-12-22 16:00 SarahLiu77 阅读(264) 评论(0) 推荐(0)
摘要:Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2016-12-21 16:35 SarahLiu77 阅读(185) 评论(0) 推荐(0)
摘要:Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n  阅读全文
posted @ 2016-12-20 16:08 SarahLiu77 阅读(197) 评论(0) 推荐(0)
摘要:关于回文字符串会有很多算法题,下面收集了一些常见的算法。 [LeetCode] Palindrome Pairs 回文对 Given a list of unique words, find all pairs of distinct indices (i, j) in the given list 阅读全文
posted @ 2016-11-03 14:41 SarahLiu77 阅读(534) 评论(0) 推荐(0)
摘要:【leetcode】349. Intersection of Two Arrays Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2  阅读全文
posted @ 2016-10-27 16:36 SarahLiu77 阅读(763) 评论(0) 推荐(0)
摘要:【leetcode】409. Longest Palindrome Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can 阅读全文
posted @ 2016-10-26 10:37 SarahLiu77 阅读(177) 评论(0) 推荐(0)
摘要:【leetcode】438. Find All Anagrams in a String Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings consi 阅读全文
posted @ 2016-10-26 10:22 SarahLiu77 阅读(642) 评论(0) 推荐(0)
摘要:【LeetCode】First Missing Positive Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, and [3 阅读全文
posted @ 2016-10-25 16:12 SarahLiu77 阅读(137) 评论(0) 推荐(0)
摘要:[LeetCode] 42. Trapping Rain Water Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much wate 阅读全文
posted @ 2016-10-25 14:42 SarahLiu77 阅读(152) 评论(0) 推荐(0)
摘要:【LeetCode】57. Insert Interval Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume 阅读全文
posted @ 2016-10-21 14:31 SarahLiu77 阅读(464) 评论(0) 推荐(0)
摘要:75. Sort Colors 问题描述: 给一个包含n个数字的数组,其中有0,1,2;排序使得所有相同的数字相邻,且按照0,1,2的顺序。 思路: (1)计数排序: 需要扫两遍数组,一遍统计个数,第二遍开始摆放数字。 代码如下: (2)如果只能扫一遍,很容易想到的就是左边存放0和1,右边存放2.两 阅读全文
posted @ 2016-10-19 19:02 SarahLiu77 阅读(173) 评论(0) 推荐(0)
摘要:1.Word Ladder 问题描述: 给两个word(beginWord和endWord)和一个字典word list,找出从beginWord到endWord之间的长度最长的一个序列,条件: 1.字典中的每个单词只能使用一次; 2.序列中的每个单词都必须是字典中的单词; 例如: Given:be 阅读全文
posted @ 2016-10-19 11:37 SarahLiu77 阅读(277) 评论(0) 推荐(0)