LeetCode Contiguous Array Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. Example 1: Input: Output: 2 Explanation: is the longest contiguous subarray with equal number of 0 and 1. Example... Read More

# Tag Archives: 数组

# hihoCoder 1496-寻找最大值

hihoCoder 1496-寻找最大值 #1496 : 寻找最大值 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定N个数A1, A2, A3, ... AN，小Ho想从中找到两个数Ai和Aj(i ≠ j)使得乘积Ai × Aj × (Ai AND... Read More

# LeetCode Game of Life

LeetCode Game of Life According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970." Given a board with m by n cells, each cell has an... Read More

# LeetCode Third Maximum Number

LeetCode Third Maximum Number Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n). Example 1: Input: Output: 1 Explanation: The... Read More

# LeetCode Summary Ranges

LeetCode Summary Ranges Given a sorted integer array without duplicates, return the summary of its ranges. For example, given , return... Read More

# LeetCode Set Matrix Zeroes

LeetCode Set Matrix Zeroes Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. click to show follow up. Follow up: Did you use extra space? A straight forward solution using O(mn) space is probably a bad... Read More

# LeetCode Rotate Array

LeetCode Rotate Array Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array is rotated to . Note: Try to come up as many solutions as you can, there are at least 3 different ways to solve this... Read More

# LeetCode Insert Interval

LeetCode Insert Interval Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start times. Example 1: Given intervals ,,... Read More

# LeetCode Jump Game

LeetCode Jump Game Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last... Read More

# LeetCode Search for a Range

LeetCode Search for a Range Given an array of integers sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in the... Read More