摘要:
Given a non-empty string containing an out-of-order English representation of digits 0-9, output the digits in ascending order. Note: Example 1: Examp 阅读全文
摘要:
Given a sequence of words, check whether it forms a valid word square. A sequence of words forms a valid word square if the kth row and column read th 阅读全文
摘要:
Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231. Find the maximum result of ai XOR aj, where 0 ≤ i, j < n. Could you do t 阅读全文
摘要:
A password is considered strong if below conditions are all met: Write a function strongPasswordChecker(s), that takes a string s as input, and return 阅读全文
摘要:
Given an integer array nums, return the third distinct maximum number in this array. If the third maximum does not exist, return the maximum number. E 阅读全文
摘要:
Given an 2D board, count how many battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may ass 阅读全文
摘要:
Given a rows x cols screen and a sentence represented by a list of words, find how many times the given sentence can be fitted on the screen. Note: Ex 阅读全文
摘要:
A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the 阅读全文
摘要:
Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the numbe 阅读全文
摘要:
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 阅读全文
摘要:
Given a string, find the length of the longest substring without repeating characters. Have you met this question in a real interview? Yes Given a str 阅读全文
摘要:
Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both 阅读全文
摘要:
Reverse a linked list. Have you met this question in a real interview? Yes Reverse a linked list. Reverse a linked list. Have you met this question in 阅读全文
摘要:
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. There are two sorted arrays A and B of siz 阅读全文
摘要:
Given two non-negative numbers num1 and num2 represented as string, return the sum of num1 and num2. Note: The length of both num1 and num2 is < 5100. 阅读全文
摘要:
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Have you met this question in a real interview? Yes 阅读全文
摘要:
A string such as "word" contains the following abbreviations: ["word", "1ord", "w1rd", "wo1d", "wor1", "2rd", "w2d", "wo2", "1o1d", "1or1", "w1r1", "1 阅读全文
摘要:
Given an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algor 阅读全文
摘要:
Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters. L 阅读全文
摘要:
Given a non-empty string s and an abbreviation abbr, return whether the string matches with the given abbreviation. A string such as "word" contains o 阅读全文
摘要:
Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to 阅读全文
摘要:
Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers(h, k), where h is the height of the perso 阅读全文
摘要:
Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. Note: Example 1: Example 2: 阅读全文
摘要:
Find the sum of all left leaves in a given binary tree. Example: 这道题让我们求一棵二叉树的所有左子叶的和,那么看到这道题我们知道这肯定是考二叉树的遍历问题,那么最简洁的写法肯定是用递归,由于我们只需要累加左子叶之和,那么我们在进入递归 阅读全文
摘要:
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the 阅读全文
摘要:
A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represents 阅读全文
摘要:
Given an integer n, return the nth digit of the infinite integer sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...]. Example 1: Input: n = 3 Output: 3 阅读全文
摘要:
A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but i 阅读全文
摘要:
Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. Note: The l 阅读全文
摘要:
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two n 阅读全文
摘要:
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of 阅读全文
摘要:
Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given 阅读全文
摘要:
Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number m 阅读全文
摘要:
Given a positive integer n and you can do operations as follow: What is the minimum number of replacements needed for n to become 1? Example 1: Exampl 阅读全文
摘要:
Given an array of integers A and let n to be its length. Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define a 阅读全文
摘要:
There are n coins with different value in a line. Two players take turns to take one or two coins from left side until there are no more coins left. T 阅读全文
摘要:
There are n coins in a line. Two players take turns to take one or two coins from right side until there are no more coins left. The player who take t 阅读全文
摘要:
There is a list of sorted integers from 1 to n. Starting from left to right, remove the first number and every other number afterward until you reach 阅读全文