题目Given an array A of positive integers, call a (contiguous, not necessarily distinct) ...
题目Given an array A of positive integers, call a (contiguous, not necessarily distinct) ...
找所有 local maximum,array 满足两个条件|a[i] - a[i-1]| = 1 The local maxima are sparseE.g. 1 2 3...
题目The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that...
题目This question is about implementing a basic elimination algorithm for Candy Crush. Gi...
题目You are playing the following Flip Game with your friend: Given a string that contain...
题目You are playing the following Flip Game with your friend: Given a string that contain...
题目Given two integers representing the numerator and denominator of a fraction, return t...
题目In a row of seats, 1 represents a person sitting in that seat, and 0 represents that ...
题目略 答案这个答案Leetcode TLE了,但是面试里面可以说。
题目Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ tim...
题目Given an array of size n, find the majority element. The majority element is the elem...
题目Sort a linked list in O(n log n) time using constant space complexity. 答案
题目We have an array A of non-negative integers. For every (contiguous) subarray B = [A[i...
题目Median is the middle value in an ordered integer list. If the size of the list is eve...
题目略 答案 这题能不能用类似Serialize and Deserialize Binary Tree的方法呢?即, 每当遇到一个子树的child为null时,插入一个#。...
题目Given n books and the ith book has A[i] pages. You are given k people to copy the n b...
题目Given two strings, find the longest common substring. Return the length of it. Exampl...
题目Given two sequence P and Q of numbers. The task is to find Longest Common Subsequence...