1.3k words 1 mins.

150 · Best Time to Buy and Sell Stock II - LintCode # Description Given an array prices , which represents the price of a stock in each day. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times). However, you may not engage in multiple...
1.4k words 1 mins.

149 · Best Time to Buy and Sell Stock - LintCode # Description Say you have an array for which the _i_th element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the...
1k words 1 mins.

419 · Roman to Integer - LintCode # Description Given a roman numeral, convert it to an integer. The answer is guaranteed to be within the range from 1 to 3999. What is Roman...
851 words 1 mins.

https://www.lintcode.com/problem/157/ # Description Implement an algorithm to determine if a string has all unique characters. # Example Example 1: Input: "abc_____" Output: false Example 2: Input: "abc" Output: true Challenge What if you can not use extra...
1k words 1 mins.

55 · Compare Strings - LintCode # Description Compare two strings A and B , determine whether A contains all of the characters in B . The characters in string A and B are all Upper Case letters. The characters of B in A are not necessary continuous or ordered. # Example Example 1: Input: A =...
940 words 1 mins.

491 · Palindrome Number - LintCode # Description Check a positive number is a palindrome or not. A palindrome number is that if you reverse the whole number you will get exactly the same number. It's guaranteed the input number is a 32-bit integer, but after reversion, the number may exceed the...
1.9k words 2 mins.

468 · Symmetric Binary Tree - LintCode Description Given a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). Example Example 1: Input: {1,2,2,3,4,4,3} Output: true Explanation:          1         / \        2 2       / \ / \      3 4 4 3 is...
957 words 1 mins.

213 · String Compression - LintCode # Description Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become a2b1c5a3 . If the "compressed" string would not become smaller than the original...
3.1k words 3 mins.

778 · Pacific Atlantic Water Flow - LintCode # Description Given an m x n matrix of non-negative integers representing the height of each unit cell in a continent, the "Pacific ocean" touches the left and top edges of the matrix and the "Atlantic ocean" touches...
1.3k words 1 mins.

38 · Search a 2D Matrix II - LintCode # Description Write an efficient algorithm that searches for a value in an m x n matrix, return The number of occurrence of it. This matrix has the following properties: Integers in each row are sorted from left to right. Integers in each column are sorted...