随笔分类 -  Array

1 2 3 4 5 ··· 10 下一页
摘要:Given an array arr of positive integers sorted in a strictly increasing order, and an integer k. Return the kth positive integer that is missing from 阅读全文
posted @ 2025-01-09 09:39 北叶青藤 阅读(21) 评论(0) 推荐(0)
摘要:Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of sto 阅读全文
posted @ 2021-04-09 23:59 北叶青藤 阅读(54) 评论(0) 推荐(0)
摘要:A permutation perm of n + 1 integers of all the integers in the range [0, n] can be represented as a string s of length n where: s[i] == 'I' if perm[i 阅读全文
posted @ 2021-04-09 22:47 北叶青藤 阅读(72) 评论(0) 推荐(0)
摘要:You are the manager of a basketball team. For the upcoming tournament, you want to choose the team with the highest overall score. The score of the te 阅读全文
posted @ 2021-04-09 21:38 北叶青藤 阅读(90) 评论(0) 推荐(0)
摘要:Given a 2D grid consists of 0s (land) and 1s (water). An island is a maximal 4-directionally connected group of 0s and a closed island is an island to 阅读全文
posted @ 2021-04-09 10:48 北叶青藤 阅读(67) 评论(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 @ 2021-04-08 09:12 北叶青藤 阅读(53) 评论(0) 推荐(0)
摘要:Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. Example 1: I 阅读全文
posted @ 2021-04-08 00:15 北叶青藤 阅读(47) 评论(0) 推荐(0)
摘要:Given a matrix of integers A with R rows and C columns, find the maximum score of a path starting at [0,0] and ending at [R-1,C-1]. The score of a pat 阅读全文
posted @ 2021-03-31 22:35 北叶青藤 阅读(76) 评论(0) 推荐(0)
摘要:There are n buildings in a line. You are given an integer array heights of size n that represents the heights of the buildings in the line. The ocean 阅读全文
posted @ 2021-03-16 22:14 北叶青藤 阅读(183) 评论(0) 推荐(0)
摘要:Some people will make friend requests. The list of their ages is given and ages[i] is the age of the ith person. Person A will NOT friend request pers 阅读全文
posted @ 2021-03-15 12:12 北叶青藤 阅读(71) 评论(0) 推荐(0)
摘要:Given an array of integers nums, calculate the pivot index of this array. The pivot index is the index where the sum of all the numbers strictly to th 阅读全文
posted @ 2021-03-15 11:49 北叶青藤 阅读(71) 评论(0) 推荐(0)
摘要:Given an unsorted array of integers nums, return the length of the longest continuous increasing subsequence (i.e. subarray). The subsequence must be  阅读全文
posted @ 2021-03-14 12:43 北叶青藤 阅读(66) 评论(0) 推荐(0)
摘要:Given an integer array arr, remove a subarray (can be empty) from arr such that the remaining elements in arr are non-decreasing. A subarray is a cont 阅读全文
posted @ 2021-03-14 01:42 北叶青藤 阅读(94) 评论(0) 推荐(0)
摘要:第二题 给两个数组,两个数组中的元素都是pair<int, int>,数组表示压缩后的一串数字 A: [(1, 2), (3,1), (2,3), (3, 1)] 表示 {1, 1, 3, 2, 2, 2, 3} B: [(5, 1), (1,1), (3,4), (2, 1)] 表示 {5, 1, 阅读全文
posted @ 2021-03-13 10:52 北叶青藤 阅读(83) 评论(0) 推荐(0)
摘要:You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once. 阅读全文
posted @ 2021-03-13 03:52 北叶青藤 阅读(25) 评论(0) 推荐(0)
摘要:Given two sparse vectors, compute their dot product. Implement class SparseVector: SparseVector(nums) Initializes the object with the vector nums dotP 阅读全文
posted @ 2021-03-12 05:53 北叶青藤 阅读(495) 评论(0) 推荐(0)
摘要:Given an array of characters chars, compress it using the following algorithm: Begin with an empty string s. For each group of consecutive repeating c 阅读全文
posted @ 2021-03-11 02:23 北叶青藤 阅读(51) 评论(0) 推荐(0)
摘要:Case 1: 在一个sorted array里面找出target value的 index,如果target value 出现了多次,返回任何一个就可以了。 Cas 2: Find the smallest number which is greater than the target Case 阅读全文
posted @ 2021-03-07 10:03 北叶青藤 阅读(59) 评论(0) 推荐(0)
摘要:(This problem is an interactive problem.) A row-sorted binary matrix means that all elements are 0 or 1 and each row of the matrix is sorted in non-de 阅读全文
posted @ 2021-03-07 09:40 北叶青藤 阅读(89) 评论(0) 推荐(0)
摘要:Given an array of integers nums and an integer target. Return the number of non-empty subsequences of nums such that the sum of the minimum and maximu 阅读全文
posted @ 2021-03-03 00:16 北叶青藤 阅读(250) 评论(0) 推荐(0)

1 2 3 4 5 ··· 10 下一页