题目Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the
...
题目Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in
...
题目Given a string s and a string t, check if s is subsequence of t.
A subsequence of a string is a new string which is formed from the original string
...
题目Given an integer, write a function to determine if it is a power of two.
Example 1:
123Input: 1Output: true Explanation: 20 = 1
Example 2:
123Input
...
题目You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that
...
题目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 pe
...
题目Given an array w of positive integers, where w[i] describes the weight of index i, write a function pickIndex which randomly picks an index in propo
...
题目Write a function that reverses a string. The input string is given as an array of characters char[].
Do not allocate extra space for another array,
...
题目There are 2N people a company is planning to interview. The cost of flying the i-th person to city A is costs[i][0], and the cost of flying the i-th
...
题目Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
Example 1:
123Input: head = [4,5,1,9],
...