随笔分类 - Array
摘要:[抄题]: We are given an array asteroids of integers representing asteroids in a row. For each asteroid, the absolute value represents its size, and the
阅读全文
摘要:[抄题]: Given an integer array, your task is to find all the different possible increasing subsequences of the given array, and the length of an increas
阅读全文
摘要:[抄题]: Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image. Example:
阅读全文
摘要:[抄题]: Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: [暴力解法]:
阅读全文
摘要:gas = [1,2,3,4,5], cost = [3,4,5,1,2]index =[0,1,2,3,4]//cost = index - 1 [抄题]: There are N gas stations along a circular route, where the amount of g
阅读全文
摘要:[抄题]: Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appe
阅读全文
摘要:[抄题]: Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. Note: You may
阅读全文
摘要:[抄题]: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Example 1: Example 2: [暴力解法]: 时间分析: 空间分
阅读全文
摘要:[抄题]: Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[
阅读全文
摘要:[抄题]: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place. Example 1: [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空间分析:
阅读全文
摘要:[抄题]: Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Exampl
阅读全文
摘要:[抄题]: Given an unsorted array of integers, find the number of longest increasing subsequence. Example 1: Example 2: [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空
阅读全文
摘要:[抄题]: Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you coul
阅读全文
摘要:[抄题]: Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. Acc
阅读全文
摘要:[抄题]: Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums e
阅读全文
摘要:[抄题]: Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses. Now, you are g
阅读全文
摘要:[抄题]: We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an intege
阅读全文
摘要:[抄题]: he set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to anot
阅读全文
摘要:[抄题]: Given m arrays, and each array is sorted in ascending order. Now you can pick up two integers from two different arrays (each array picks one) a
阅读全文
摘要:[抄题]: Given an array of integers nums, write a method that returns the "pivot" index of this array. We define the pivot index as the index where the s
阅读全文

浙公网安备 33010602011771号