[LeetCode] Plus One Linked List

2018-08-19
阅读 1 分钟
1.8k
Given a non-negative integer represented as non-empty a singly linked list of digits, plus one to the integer.

[LeetCode] Third Maximum Number

2018-08-19
阅读 2 分钟
1.7k
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).

[LeetCode] Encode and Decode Strings

2018-08-15
阅读 2 分钟
2.4k
Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list of strings.

[LintCode] UTF-8 Validation

2018-08-14
阅读 2 分钟
1.8k
A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules:

[LC] Ace B

2018-08-14
阅读 2 分钟
1k
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] Longest Substring Without Repeating Characters

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

[LeetCode] 303. Range Sum Query - Immutable

2018-08-02
阅读 1 分钟
1.5k
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.

[LintCode/LeetCode] Contains Duplicate II

2018-07-23
阅读 1 分钟
1.9k
Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most k.

[LintCode/LeetCode] Contains Duplicate III

2018-07-23
阅读 2 分钟
1.6k
Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[i] and nums[j] is at most t and the absolute difference between i and j is at most k.

[LintCode/LeetCode] Minimum Time Difference

2018-07-23
阅读 1 分钟
1.5k
Given a list of 24-hour clock time points in "Hour:Minutes" format, find the minimum minutes difference between any two time points in the list.

[LintCode/LeetCode] Range Addition

2018-07-19
阅读 2 分钟
1.4k
Assume you have an array of length n initialized with all 0's and are given k update operations.

[LintCode/LeetCode] Set Mismatch

2018-07-18
阅读 2 分钟
2k
The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in the set, which results in repetition of one number and loss of another number.

[LintCode/LeetCode] Rotate Array

2018-07-18
阅读 1 分钟
1.3k
Given an array, rotate the array to the right by k steps, where k is non-negative.

[LintCode/LeetCode] Count Binary Substrings

2018-07-18
阅读 2 分钟
1.2k
Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings are grouped consecutively.

[LeetCode/LintCode] Sentence Similarity

2018-07-18
阅读 2 分钟
2.9k
Given two sentences words1, words2 (each represented as an array of strings), and a list of similar word pairs pairs, determine if two sentences are similar.

[LintCode] Set Union

2018-07-16
阅读 2 分钟
2.1k
There is a list composed by sets. If two sets have the same elements, merge them. In the end, there are several sets left.

[LeetCode/LintCode] Odd Even Linked List

2018-07-16
阅读 1 分钟
1.3k
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.

[LintCode/LeetCode] Integer Replacement

2018-07-16
阅读 1 分钟
1.6k
1.If n is even, replace n with n/2.2.If n is odd, you can replace n with either n + 1 or n - 1.

[LintCode/LeetCode] Count Univalue Subtrees

2018-07-16
阅读 1 分钟
2.2k
A Uni-value subtree means all nodes of the subtree have the same value.

[LeetCode] 267. Palindrome Permutation II

2018-07-08
阅读 2 分钟
2.9k
Given a string s, return all the palindromic permutations (without duplicates) of it. Return an empty list if no palindromic permutation could be form.

[LintCode] Daily Temperatures

2018-07-08
阅读 1 分钟
1.5k
Given a list of daily temperatures, produce a list that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which this is possible, put 0 instead.

[LintCode] The Number In Words

2018-07-08
阅读 2 分钟
1.5k
Problem Given a non-negative integer n, print the number in words. Example Given n = 125 Return one hundred twenty five Solution {代码...}

[LintCode/LeetCode] Best Meeting Point

2018-06-27
阅读 2 分钟
2.2k
A group of two or more people wants to meet and minimize the total travel distance. You are given a 2D grid of values 0 or 1, where each 1 marks the home of someone in the group. The distance is calculated using Manhattan Distance, where distance(p1, p2) = |p2.x - p1.x| + |p2.y - p1.y|.

[LintCode/LeetCode] Check Sum of K Primes

2018-06-27
阅读 2 分钟
2.2k
Given two numbers n and k. We need to find out if n can be written as sum of k prime numbers.

[LintCode/LeetCode] Binary Tree Pruning

2018-06-27
阅读 2 分钟
1.6k
Binary Tree PruningWe are given the head node root of a binary tree, where additionally every node's value is either a 0 or a 1.

[LintCode] Teemo Attacking

2018-06-27
阅读 2 分钟
1.4k
In LOL world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascending time series towards Ashe and the poisoning time duration per Teemo's attacking, you need to output the total time that Ashe is in poisoned cond...

[LintCode] Baseball Game

2018-06-25
阅读 3 分钟
1.5k
Given a list of strings, each string can be one of the 4 following types:

[LintCode] Minimum Absolute Difference in BST

2018-06-25
阅读 2 分钟
2.1k
Minimum Absolute Difference in BSTGiven a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes.

[LeetCode/LintCode] 24 Game

2018-06-25
阅读 4 分钟
2.2k
You have 4 cards each containing a number from 1 to 9. You need to compute whether they could operated through *, /, +, -, (, ) to get the value of 24.

[LintCode] Order Problem

2018-06-24
阅读 3 分钟
1.7k
There is now an order with demand for n items, and the demand for the i-th item is order[i]. The factory has m production modes. Each production mode is shaped like [p[1],p[2],...p[n]], that is, produce p[1] first items, p[2] second items... You can use multiple production modes. Please tell me h...