[LeetCode] 300. Longest Increasing Subsequence

2018-09-20
阅读 2 分钟
1.9k
Given an unsorted array of integers, find the length of longest increasing subsequence.

[LeetCode] 460. LFU Cache

2018-09-20
阅读 3 分钟
3.1k
Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the following operations: get and put.

[LeetCode] 210. Course Schedule II

2018-09-19
阅读 3 分钟
2k
There are a total of n courses you have to take, labeled from 0 to n-1.

[LeetCode] 269. Alien Dictionary

2018-09-19
阅读 3 分钟
3.4k
There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list of non-empty words from the dictionary, where words are sorted lexicographically by the rules of this new language. Derive the order of letters in this language.

[LeetCode] 277. Find the Celebrity

2018-09-19
阅读 3 分钟
2.9k
Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition of a celebrity is that all the other n - 1 people know him/her but he/she does not know any of them.

[LeetCode] 705. Design HashSet

2018-09-19
阅读 2 分钟
3.3k
add(value): Insert a value into the HashSet. contains(value) : Return whether the value exists in the HashSet or not.remove(value): Remove a value in the HashSet. If the value does not exist in the HashSet, do nothing.

[LeetCode] 706. Design HashMap

2018-09-19
阅读 3 分钟
3.7k
put(key, value) : Insert a (key, value) pair into the HashMap. If the value already exists in the HashMap, update the value.get(key): Returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key.remove(key) : Remove the mapping for the value key if thi...

[LeetCode] Binary Search [Beat 100%]

2018-09-18
阅读 1 分钟
1.3k
Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums. If target exists, then return its index, otherwise return -1.

[LeetCode] 811. Subdomain Visit Count

2018-09-18
阅读 4 分钟
1.5k
A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com", and at the lowest level, "discuss.leetcode.com". When we visit a domain like "discuss.leetcode.com", we will also visit the parent domains "leet...

[LeetCode] 772. Basic Calculator III

2018-09-17
阅读 3 分钟
6.7k
The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers and empty spaces .

[LeetCode] 224. Basic Calculator

2018-09-17
阅读 2 分钟
2.6k
The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers and empty spaces .

[LeetCode] 227. Basic Calculator II

2018-09-17
阅读 2 分钟
2k
The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should truncate toward zero.

[LeetCode] 647. Palindromic Substrings

2018-09-17
阅读 2 分钟
2.3k
Given a string, your task is to count how many palindromic substrings in this string.

[LeetCode] 609. Find Duplicate File in System

2018-09-17
阅读 3 分钟
1.3k
Given a list of directory info including directory path, and all the files with contents in this directory, you need to find out all the groups of duplicate files in the file system in terms of their paths.

[LeetCode] 549. Binary Tree Longest Consecutive Sequence II

2018-09-17
阅读 2 分钟
3k
Given a binary tree, you need to find the length of Longest Consecutive Path in Binary Tree.

[LeetCode] Student Attendance Record I

2018-09-16
阅读 1 分钟
1.4k
You are given a string representing an attendance record for a student. The record only contains the following three characters:'A' : Absent.'L' : Late.'P' : Present.A student could be rewarded if his attendance record doesn't contain more than one 'A' (absent) or more than two continuous 'L' (la...

[LeetCode] Validate IP Address

2018-09-16
阅读 3 分钟
1.3k
Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither.

[LeetCode] Island Perimeter

2018-09-12
阅读 2 分钟
1.9k
You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells). Th...

[LeetCode] Path Sum (I & II & III)

2018-09-12
阅读 4 分钟
3.2k
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.

[LeetCode] Insert Interval

2018-09-10
阅读 2 分钟
1.9k
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).

[LeetCode] Add Binary

2018-09-10
阅读 1 分钟
1.6k
The input strings are both non-empty and contains only characters 1 or 0.

[LeetCode] Group Anagram

2018-09-10
阅读 2 分钟
1.9k
All inputs will be in lowercase.The order of your output does not matter.

[LeetCode] Find First and Last Position of Element in Sorted

2018-09-09
阅读 2 分钟
2.6k
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.

[LeetCode] Employee Free Time

2018-09-09
阅读 2 分钟
3.5k
We are given a list schedule of employees, which represents the working time for each employee.

[LeetCode] Longest Word in Dictionary

2018-09-04
阅读 2 分钟
2k
Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other words in words. If there is more than one possible answer, return the longest word with the smallest lexicographical order.

[LeetCode/LintCode] Is Subsequence

2018-09-04
阅读 2 分钟
1.5k
You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string, and s is a short string (<=100).

[LeetCode] String Compression

2018-08-21
阅读 2 分钟
2.4k
The length after compression must always be smaller than or equal to the original array.

[LeetCode] Rotate String

2018-08-20
阅读 1 分钟
1.3k
A shift on A consists of taking string A and moving the leftmost character to the rightmost position. For example, if A = 'abcde', then it will be 'bcdea' after one shift on A. Return True if and only if A can become B after some number of shifts on A.

[LeetCode] Shortest Distance to a Character

2018-08-20
阅读 2 分钟
1.6k
Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string.

[LeetCode] Kill Process

2018-08-20
阅读 2 分钟
1.6k
Given n processes, each process has a unique PID (process id) and its PPID (parent process id).