随笔分类 -  Array

上一页 1 2 3 4 5 6 7 8 ··· 10 下一页
摘要:On a single threaded CPU, we execute some functions. Each function has a unique id between 0 and N-1. We store logs in timestamp order that describe w 阅读全文
posted @ 2019-07-03 03:38 北叶青藤 阅读(225) 评论(0) 推荐(0)
摘要:An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate (sr, 阅读全文
posted @ 2019-07-03 03:23 北叶青藤 阅读(192) 评论(0) 推荐(0)
摘要:We are given an array asteroids of integers representing asteroids in a row. For each asteroid, the absolute value represents its size, and the sign r 阅读全文
posted @ 2019-07-03 03:15 北叶青藤 阅读(222) 评论(0) 推荐(0)
摘要:A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its inde 阅读全文
posted @ 2019-06-09 11:45 北叶青藤 阅读(134) 评论(0) 推荐(0)
摘要:Given a non-negative integer numRows, generate the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers 阅读全文
posted @ 2019-04-28 11:36 北叶青藤 阅读(123) 评论(0) 推荐(0)
摘要:Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If the 阅读全文
posted @ 2019-02-19 06:51 北叶青藤 阅读(138) 评论(0) 推荐(0)
摘要:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2019-02-03 07:59 北叶青藤 阅读(185) 评论(0) 推荐(0)
摘要:You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/ve 阅读全文
posted @ 2017-01-09 10:48 北叶青藤 阅读(174) 评论(0) 推荐(0)
摘要:This problem can be solved by using a heap. The time is O(nlog(n)). Given m arrays, the minimum elements of all arrays can form a heap. It takes O(log 阅读全文
posted @ 2017-01-05 08:52 北叶青藤 阅读(480) 评论(0) 推荐(0)
摘要:Given an 2D board, count how many different battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. Y 阅读全文
posted @ 2017-01-03 00:20 北叶青藤 阅读(256) 评论(0) 推荐(0)
摘要:In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach o 阅读全文
posted @ 2017-01-02 02:26 北叶青藤 阅读(349) 评论(0) 推荐(0)
摘要:From: http://www.geeksforgeeks.org/find-number-of-triangles-possible/ Given an unsorted array of positive integers. Find the number of triangles that 阅读全文
posted @ 2017-01-01 05:34 北叶青藤 阅读(495) 评论(0) 推荐(0)
摘要:Find the K closest points to a target point in a 2D plane. 阅读全文
posted @ 2017-01-01 04:16 北叶青藤 阅读(668) 评论(0) 推荐(0)
摘要:Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2016-12-30 10:29 北叶青藤 阅读(205) 评论(0) 推荐(0)
摘要:Question: For each word, you can get a list of neighbor words by calling getWords(String), find all the paths from word1 to word2. 阅读全文
posted @ 2016-12-24 12:49 北叶青藤 阅读(329) 评论(0) 推荐(0)
摘要:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. Th 阅读全文
posted @ 2016-12-17 23:56 北叶青藤 阅读(203) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2016-12-13 10:21 北叶青藤 阅读(204) 评论(0) 推荐(0)
摘要:Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), determine if a person could attend all mee 阅读全文
posted @ 2016-12-01 05:55 北叶青藤 阅读(724) 评论(0) 推荐(0)
摘要:一个sequence,里面都是整数,求最长的subsequence的长度,使得这个subsquence的最大值和最小值相差不超过1. 比如[1,3,2,2,5,2,3,7]最长的subsequence是[3,2,2,2,3],所以应该返回5. 分析: 这题可以先排序,然后找出两个相差1的相邻值的最大 阅读全文
posted @ 2016-11-22 00:52 北叶青藤 阅读(382) 评论(0) 推荐(0)
摘要:Given a sorted array of integers nums and integer values a, b and c. Apply a function of the form f(x) = ax2 + bx + c to each element x in the array. 阅读全文
posted @ 2016-11-20 23:33 北叶青藤 阅读(279) 评论(0) 推荐(0)

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