[LintCode/LeetCode] Meeting Rooms

2018-06-24
阅读 2 分钟
2k
Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), determine if a person could attend all meetings.

[LeetCode] 191. Number of 1 Bits

2018-06-19
阅读 2 分钟
1.9k
Number of 1 BitsWrite a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).

[LintCode] Toeplitz Matrix

2018-06-14
阅读 1 分钟
1.9k
A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element.

[LintCode] Twitch Words

2018-06-12
阅读 2 分钟
2.4k
Our normal words do not have more than two consecutive letters. If there are three or more consecutive letters, this is a tics. Now give a word, from left to right, to find out the starting point and ending point of all tics.

[LeetCode/LintCode] Largest Palindrome Product

2018-06-11
阅读 2 分钟
1.8k
Find the largest palindrome made from the product of two n-digit numbers.

[LintCode] K-diff Pairs in an Array

2018-06-11
阅读 2 分钟
2k
Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are both numbers in the array and their absolute difference is k.

[LintCode] Permutation in String

2018-06-11
阅读 2 分钟
2k
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.

[LeetCode] 367. Valid Perfect Square

2018-06-05
阅读 1 分钟
1.4k
Given a positive integer num, write a function which returns True if num is a perfect square else False.

[LintCode] 3Sum Smaller

2018-06-05
阅读 2 分钟
1.9k
Given an array of n integers nums and a target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition nums[i] + nums[j] + nums[k] < target.

[LintCode/LeetCode] Remove Duplicate Letters

2018-05-29
阅读 2 分钟
2.3k
Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical order among all possible results.

[LeetCode/LintCode] Construct the Rectangle

2018-05-29
阅读 2 分钟
1.2k
For a web developer, it is very important to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements:

[LintCode] Excel Sheet Column Number

2018-05-28
阅读 1 分钟
1.5k
Given a column title as appear in an Excel sheet, return its corresponding column number.

[LeetCode/LintCode] Binary Tree Vertical Order Traversal

2018-05-27
阅读 2 分钟
2.6k
Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column).

[LintCode] Replace With Greatest From Right

2018-05-21
阅读 1 分钟
1.4k
Given an array of integers, replace every element with the next greatest element (greatest element on the right side) in the array. Since there is no element next to the last element, replace it with -1. For example, if the array is [16, 17, 4, 3, 5, 2], then it should be modified to [17, 5, 5, 5...

[LeetCode/LintCode] Course Schedule II

2018-05-21
阅读 2 分钟
1.6k
There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]

[LintCode] Three Distinct Factors

2018-05-21
阅读 1 分钟
2.7k
Given a positive integer n (1 <= n <= 10^18). Check whether a number has exactly three distinct factors, return true if it has exactly three distinct factors, otherwise false.

[LintCode] Buy Fruits

2018-05-21
阅读 3 分钟
2.7k
Xiao Ming is going to help companies buy fruit. Give a codeList, which is loaded with the fruit he bought. Give a shoppingCart, which is loaded with target fruit. We need to check if the order in the codeList matches the order in the shoppingCart. Note that only the sum of the items in all linked...

[LeetCode] 207. Course Schedule

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

[LintCode] Check Full Binary Tree

2018-05-18
阅读 1 分钟
1.4k
A full binary tree is defined as a binary tree in which all nodes have either zero or two child nodes. Conversely, there is no node in a full binary tree, which has one child node. More information about full binary trees can be found here.

[LeetCode] Subtree of Another Tree

2018-05-13
阅读 2 分钟
2k
Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and all of this node's descendants. The tree s could also be considered as a subtree of itself.

[LeetCode] Two Sum IV - Input is a BST

2018-05-13
阅读 1 分钟
2.1k
Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.

[LeetCode] Maximum Binary Tree

2018-05-13
阅读 2 分钟
1.9k
Given an integer array with no duplicates. A maximum tree building on this array is defined as follow:

[LeetCode] Sum Root to Leaf Numbers

2018-05-12
阅读 1 分钟
1.3k
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.

[LeetCode] Closest Binary Search Tree Value

2018-05-12
阅读 1 分钟
1.7k
Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target.

[LeetCode] Find the Duplicate Number

2018-05-08
阅读 1 分钟
1.9k
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one.

[LeetCode] Compare Version Numbers

2018-05-06
阅读 2 分钟
1.6k
Compare two version numbers version1 and version2.If version1 > version2 return 1; if version1 < version2 return -1;otherwise return 0.

[LeetCode] Product of Array Except Self

2018-05-03
阅读 2 分钟
1.7k
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].

[LeetCode] Maximum Size Subarray Sum Equals k

2018-05-03
阅读 2 分钟
1.7k
Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0 instead.

[LeetCode] Reverse Words in a String II

2018-05-02
阅读 1 分钟
1.9k
Reverse Words in a String IIGiven an input string , reverse the string word by word.

[LeetCode] Integer to English Words

2018-05-02
阅读 2 分钟
1.5k
Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1.