随笔分类 -  Array

上一页 1 2 3 4 5 6 7 ··· 10 下一页
摘要:Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be 阅读全文
posted @ 2019-08-18 03:14 北叶青藤 阅读(159) 评论(0) 推荐(0)
摘要:Given a 01 matrix M, find the longest line of consecutive one in the matrix. The line could be horizontal, vertical, diagonal or anti-diagonal. Exampl 阅读全文
posted @ 2019-08-16 12:18 北叶青藤 阅读(205) 评论(0) 推荐(0)
摘要:Your task is to design the basic function of Excel and implement the function of sum formula. Specifically, you need to implement the following functi 阅读全文
posted @ 2019-08-12 09:14 北叶青藤 阅读(337) 评论(0) 推荐(0)
摘要:Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (F 阅读全文
posted @ 2019-08-11 09:02 北叶青藤 阅读(225) 评论(0) 推荐(0)
摘要:Let's play the minesweeper game (Wikipedia, online game)! You are given a 2D char matrix representing the game board. 'M' represents an unrevealed min 阅读全文
posted @ 2019-08-08 14:41 北叶青藤 阅读(702) 评论(0) 推荐(0)
摘要:Given an array with distinct numbers, return an integer indicating the minimum number of swap operations required to sort the array into ascending ord 阅读全文
posted @ 2019-08-04 08:48 北叶青藤 阅读(211) 评论(0) 推荐(0)
摘要:Find the longest increasing subsequence in an array. If there are multiple, return one of them. Example, for [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 阅读全文
posted @ 2019-08-04 05:34 北叶青藤 阅读(123) 评论(0) 推荐(0)
摘要:A conveyor belt has packages that must be shipped from one port to another within D days. The i-th package on the conveyor belt has a weight of weight 阅读全文
posted @ 2019-08-02 14:38 北叶青藤 阅读(275) 评论(0) 推荐(0)
摘要:Given a 2D grid, each cell is either a wall 'W', an enemy 'E' or empty '0' (the number zero), return the maximum enemies you can kill using one bomb.T 阅读全文
posted @ 2019-08-02 12:53 北叶青藤 阅读(148) 评论(0) 推荐(0)
摘要:You want to build a house on an empty land which reaches all buildings in the shortest amount of distance. You can only move up, down, left and right. 阅读全文
posted @ 2019-07-29 03:11 北叶青藤 阅读(279) 评论(0) 推荐(0)
摘要:Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two 阅读全文
posted @ 2019-07-28 03:44 北叶青藤 阅读(282) 评论(0) 推荐(0)
摘要:Your are given an array of positive integers nums. Count and print the number of (contiguous) subarrays where the product of all the elements in the s 阅读全文
posted @ 2019-07-20 16:08 北叶青藤 阅读(274) 评论(0) 推荐(0)
摘要:In a country popular for train travel, you have planned some train travelling one year in advance. The days of the year that you will travel is given 阅读全文
posted @ 2019-07-19 14:32 北叶青藤 阅读(282) 评论(0) 推荐(0)
摘要:Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order. Examp 阅读全文
posted @ 2019-07-19 13:43 北叶青藤 阅读(243) 评论(0) 推荐(0)
摘要:On a 2x3 board, there are 5 tiles represented by the integers 1 through 5, and an empty square represented by 0. A move consists of choosing 0 and a 4 阅读全文
posted @ 2019-07-17 14:05 北叶青藤 阅读(275) 评论(0) 推荐(0)
摘要:We have a list of points on the plane. Find the K closest points to the origin (0, 0). (Here, the distance between two points on a plane is the Euclid 阅读全文
posted @ 2019-07-15 02:03 北叶青藤 阅读(359) 评论(0) 推荐(0)
摘要:Given N, consider a convex N-sided polygon with vertices labelled A[0], A[i], ..., A[N-1] in clockwise order. Suppose you triangulate the polygon into 阅读全文
posted @ 2019-07-09 09:33 北叶青藤 阅读(655) 评论(0) 推荐(0)
摘要:In a given integer array nums, there is always exactly one largest element. Find whether the largest element in the array is at least twice as much as 阅读全文
posted @ 2019-07-08 05:10 北叶青藤 阅读(203) 评论(0) 推荐(0)
摘要:Given an array of integers A with even length, return true if and only if it is possible to reorder it such that A[2 * i + 1] = 2 * A[2 * i] for every 阅读全文
posted @ 2019-07-08 01:47 北叶青藤 阅读(219) 评论(0) 推荐(0)
摘要:There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rolling up, down, left or right, but it won't stop roll 阅读全文
posted @ 2019-07-07 13:38 北叶青藤 阅读(489) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 ··· 10 下一页