[LeetCode] 876. Middle of the Linked List

2018-12-31
阅读 2 分钟
1.9k
Given a non-empty, singly linked list with head node head, return a middle node of linked list.

[LeetCode] 905. Sort Array By Parity

2018-12-31
阅读 1 分钟
1.6k
Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.

[LeetCode] 487. Max Consecutive Ones II

2018-12-14
阅读 1 分钟
1.8k
Given a binary array, find the maximum number of consecutive 1s in this array if you can flip at most one 0.

[LeetCode] 763. Partition Labels

2018-12-12
阅读 3 分钟
1.8k
A string S of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers representing the size of these parts.

[LeetCode] 159. Longest Substring with At Most Two Distinct

2018-12-05
阅读 1 分钟
2.1k
Given a string s , find the length of the longest substring t that contains at most 2 distinct characters.

[LeetCode] 727. Minimum Window Subsequence

2018-12-05
阅读 2 分钟
3k
Given strings S and T, find the minimum (contiguous) substring W of S, so that T is a subsequence of W.

[LeetCode] 86. Partition List

2018-12-02
阅读 1 分钟
2k
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.

[LeetCode] 862. Shortest Subarray with Sum at Least K

2018-11-26
阅读 2 分钟
3.2k
Return the length of the shortest, non-empty, contiguous subarray of A with sum at least K.

[LeetCode] 209. Minimum Size Subarray Sum (Easy version LC 862)

2018-11-26
阅读 1 分钟
1.6k
Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't one, return 0 instead.

[LeetCode] 457. Circular Array Loop

2018-11-17
阅读 2 分钟
3.3k
You are given an array of positive and negative integers. If a number n at an index is positive, then move forward n steps. Conversely, if it's negative (-n), move backward n steps. Assume the first element of the array is forward next to the last element, and the last element is backward next to...

[LeetCode] 408. Valid Word Abbreviation

2018-11-17
阅读 2 分钟
2.5k
Given a non-empty string s and an abbreviation abbr, return whether the string matches with the given abbreviation.

[LeetCode] 109. Convert Sorted List to Binary Search Tree

2018-11-15
阅读 1 分钟
2.6k
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.

[LeetCode] 917. Reverse Only Letters

2018-11-08
阅读 1 分钟
2.7k
Given a string S, return the "reversed" string where all characters that are not a letter stay in the same place, and all letters reverse their positions.

[LeetCode] 849. Maximize Distance to Closest Person

2018-10-31
阅读 2 分钟
2.1k
In a row of seats, 1 represents a person sitting in that seat, and 0 represents that the seat is empty.

[LeetCode] 904. Fruit Into Baskets

2018-10-30
阅读 2 分钟
3.4k
You start at any tree of your choice, then repeatedly perform the following steps:

[LeetCode] 567. Permutation in String

2018-10-28
阅读 2 分钟
1.9k
Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutations is the substring of the second string.Example 1:

[LeetCode] 524. Longest Word in Dictionary through Deleting

2018-10-09
阅读 2 分钟
2.3k
Given a string and a string dictionary, find the longest string in the dictionary that can be formed by deleting some characters of the given string. If there are more than one possible results, return the longest word with the smallest lexicographical order. If there is no possible result, retur...

[LeetCode] 632. Smallest Range

2018-10-08
阅读 4 分钟
2.7k
You have k lists of sorted integers in ascending order. Find the smallest range that includes at least one number from each of the k lists.

[LeetCode] 611. Valid Triangle Number

2018-09-24
阅读 1 分钟
2.3k
Given an array consists of non-negative integers, your task is to count the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle.Example 1:Input: [2,2,3,4]Output: 3Explanation:Valid combinations are: 2,3,4 (using the first 2)2,3,4 (using t...

[LeetCode] Longest Substring Without Repeating Characters

2018-08-02
阅读 1 分钟
2k
Given a string, find the length of the longest substring without repeating characters.

【LC总结】KMP * Implement Strstr

2016-09-30
阅读 1 分钟
1.8k
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

【LC总结】K Sum (Two Sum I II/3Sum/4Sum/3Sum Closest)

2016-09-23
阅读 7 分钟
3.1k
Given an array of integers, find two numbers such that they add up to a specific target number.

[LintCode/LeetCode] Intersection of Two Arrays I & II [BitSet]

2016-06-08
阅读 2 分钟
3k
Each element in the result must be unique.The result can be in any order.

[LeetCode] Longest Substring Without Repeating Characters

2016-06-03
阅读 2 分钟
1.8k
Given a string, find the length of the longest substring without repeating characters.

[LeetCode] Reverse Vowels of a String

2016-05-30
阅读 2 分钟
2.2k
Write a function that takes a string as input and reverse only the vowels of a string.

[LintCode] Move Zeroes

2016-05-29
阅读 2 分钟
2.1k
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.

[LintCode/LeetCode] Minimum Window Substring

2016-05-23
阅读 3 分钟
2.3k
Given a string source and a string target, find the minimum window in source which will contain all the characters in target.

[LeetCode] 4Sum & 4Sum II

2016-05-21
阅读 4 分钟
1.9k
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target?

[LintCode/LeetCode] 3Sum Closest

2016-05-21
阅读 1 分钟
2.1k
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers.

[LintCode/LeetCode] Partition List

2016-04-28
阅读 2 分钟
2k
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.