【LeetCode】数组

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica }

【1】Two Sum

【4】Median of Two Sorted Arrays

【11】Container With Most Water

【15】3Sum

【16】3Sum Closest

【18】4Sum

【26】Remove Duplicates from Sorted Array

【27】Remove Element

【31】Next Permutation

【33】Search in Rotated Sorted Array

【34】Find First and Last Position of Element in Sorted Array

【35】Search Insert Position

【39】Combination Sum

【40】Combination Sum II

【41】First Missing Positive

【42】Trapping Rain Water

【45】Jump Game II

【48】Rotate Image

【53】Maximum Subarray

【54】Spiral Matrix

【55】Jump Game

【56】Merge Intervals

【57】Insert Interval

【59】Spiral Matrix II

【62】Unique Paths

【63】Unique Paths II

【64】Minimum Path Sum

【66】Plus One

【73】Set Matrix Zeroes

【74】Search a 2D Matrix

【75】Sort Colors

【78】Subsets

【79】Word Search

【80】Remove Duplicates from Sorted Array II

【81】Search in Rotated Sorted Array II

【84】Largest Rectangle in Histogram

【85】Maximal Rectangle

【88】Merge Sorted Array

【90】Subsets II

【105】Construct Binary Tree from Preorder and Inorder Traversal

【106】Construct Binary Tree from Inorder and Postorder Traversal

【118】Pascal‘s Triangle

【119】Pascal‘s Triangle II

【120】Triangle

【121】Best Time to Buy and Sell Stock

【122】Best Time to Buy and Sell Stock II

【123】Best Time to Buy and Sell Stock III

【126】Word Ladder II

【128】Longest Consecutive Sequence

【152】Maximum Product Subarray

【153】Find Minimum in Rotated Sorted Array

【154】Find Minimum in Rotated Sorted Array II

【162】Find Peak Element

【163】Missing Ranges

【167】Two Sum II - Input array is sorted

【169】Majority Element

【189】Rotate Array

【209】Minimum Size Subarray Sum

【216】Combination Sum III

【217】Contains Duplicate

【219】Contains Duplicate II

【228】Summary Ranges

【229】Majority Element II

【238】Product of Array Except Self

【243】Shortest Word Distance

【245】Shortest Word Distance III

【259】3Sum Smaller

【268】Missing Number

【277】Find the Celebrity

【280】Wiggle Sort

【283】Move Zeroes

【287】Find the Duplicate Number

【289】Game of Life

【370】Range Addition

【380】Insert Delete GetRandom O(1)

【381】Insert Delete GetRandom O(1) - Duplicates allowed

【414】Third Maximum Number

【442】Find All Duplicates in an Array

【448】Find All Numbers Disappeared in an Array

【485】Max Consecutive Ones

【495】Teemo Attacking

【531】Lonely Pixel I

【532】K-diff Pairs in an Array

【533】Lonely Pixel II

【548】Split Array with Equal Sum

【560】Subarray Sum Equals K

【561】Array Partition I

【562】Longest Line of Consecutive One in Matrix

【565】Array Nesting

【566】Reshape the Matrix

【581】Shortest Unsorted Continuous Subarray

【605】Can Place Flowers

【611】Valid Triangle Number

【621】Task Scheduler

【624】Maximum Distance in Arrays

【628】Maximum Product of Three Numbers

【643】Maximum Average Subarray I

【644】Maximum Average Subarray II

【661】Image Smoother

【665】Non-decreasing Array

【667】Beautiful Arrangement II

【670】Maximum Swap

【674】Longest Continuous Increasing Subsequence

【683】K Empty Slots

【689】Maximum Sum of 3 Non-Overlapping Subarrays

【695】Max Area of Island

【697】Degree of an Array

【713】Subarray Product Less Than K

【714】Best Time to Buy and Sell Stock with Transaction Fee

【715】Range Module

【717】1-bit and 2-bit Characters

【718】Maximum Length of Repeated Subarray

【719】Find K-th Smallest Pair Distance

【723】Candy Crush

【724】Find Pivot Index

【729】My Calendar I

【731】My Calendar II

【746】Min Cost Climbing Stairs

【747】Largest Number At Least Twice of Others

【755】Pour Water

【766】Toeplitz Matrix

【768】Max Chunks To Make Sorted II

【769】Max Chunks To Make Sorted

【775】Global and Local Inversions

【782】Transform to Chessboard

【792】Number of Matching Subsequences

【795】Number of Subarrays with Bounded Maximum

【825】Friends Of Appropriate Ages

【830】Positions of Large Groups

【832】Flipping an Image

【835】Image Overlap

【840】Magic Squares In Grid

【849】Maximize Distance to Closest Person

【867】Transpose Matrix

【870】Advantage Shuffle

【873】Length of Longest Fibonacci Subsequence

【888】Fair Candy Swap

【891】Sum of Subsequence Widths

【896】Monotonic Array

【】

原文地址:https://www.cnblogs.com/zhangwanying/p/9610923.html

时间: 2024-08-06 07:54:48

【LeetCode】数组的相关文章

Leetcode数组题*3

目录 Leetcode数组题*3 66.加一 题目描述 思路分析 88.合并两个有序数组 题目描述 思路分析 167.两数之和Ⅱ-输入有序数组 题目描述 思路分析 Leetcode数组题*3 66.加一 题目描述 给定一个由整数组成的非空数组所表示的非负整数,在该数的基础上加一. 最高位数字存放在数组的首位, 数组中每个元素只存储单个数字. 你可以假设除了整数 0 之外,这个整数不会以零开头. 示例: 输入: [1,2,3] 输出: [1,2,4] 解释: 输入数组表示数字 123. 链接:ht

LeetCode 数组转二叉树 C#

把LeetCode二叉树题目的测试数组,转换成二叉树 class TreeNode { public int val; public TreeNode left; public TreeNode right; public TreeNode(int x) { val = x; } } class Tree { public static TreeNode CreateNode(int? val) { if (val == null) return null; return new TreeNod

leetcode 数组 (python)

1.题目描述 给定一个范围在  1 ≤ a[i] ≤ n ( n = 数组大小 ) 的 整型数组,数组中的元素一些出现了两次,另一些只出现一次. 找到所有在 [1, n] 范围之间没有出现在数组中的数字. 您能在不使用额外空间且时间复杂度为O(n)的情况下完成这个任务吗? 你可以假定返回的数组不算在额外空间内. 示例: 输入: [4,3,2,7,8,2,3,1] 输出: [5,6] 2. 思路 题目中给定n个元素的数组其元素范围在1~n之间,可以考虑数组元素值和其下标的关系.比较元素nums[i

[leetcode数组系列]2三数之和

前言 秋招的结束,面试了大大小小的公司,最大的问题在于算法上.所以打算坚持在leetcode打卡,看看到底能不能行,如果你想见证,那我来开车,你坐稳,一起走向更好的远方. 在学习今天内容之前,先学习上一篇的两数之和会更好哟 leetcode两数之和求解 一 题目 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整给定一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?找出所有满

做几个leetcode数组题二

1.Longest Consecutive Sequence Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Given [100, 4, 200, 1, 3, 2], The longest consecutive elements sequence is [1, 2, 3, 4]. Return its length:

[LeetCode]数组——买卖股票的最佳时机 II

给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格. 设计一个算法来计算你所能获取的最大利润.你可以尽可能地完成更多的交易(多次买卖一支股票). 注意:你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票). C++ class Solution { public: int maxProfit(vector<int>& prices) { int sum = 0; for (size_t i = 1; i < prices.size(); i++) { if (

[LeetCode]数组——存在重复

给定一个整数数组,判断是否存在重复元素. 如果任何值在数组中出现至少两次,函数返回 true.如果数组中每个元素都不相同,则返回 false. C++ class Solution { public: bool containsDuplicate(vector<int>& nums) { unordered_map<int, int>m; for (int i = 0; i < nums.size(); i++) { if (m.find(nums[i]) != m.

[LeetCode]数组——两个数组的交集 II

给定两个数组,写一个方法来计算它们的交集. C++ class Solution { public: vector<int> intersect(vector<int>& nums1, vector<int>& nums2) { unordered_map<int, int> m; vector<int> res; for (auto a : nums1) m[a]++; for (auto a : nums2) { if (m[

[LeetCode]数组——移动零

给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序. C++ class Solution { public: void moveZeroes(vector<int>& nums) { for (int i = 0, j = 0; i < nums.size(); i++) { if (nums[i]) { swap(nums[i], nums[j++]); } } } }; C void moveZeroes(int* nums, in

[LeetCode]数组—— 两数之和

给定一个整数数组和一个目标值,找出数组中和为目标值的两个数. 你可以假设每个输入只对应一种答案,且同样的元素不能被重复利用. C++ class Solution { public: vector<int> twoSum(vector<int>& nums, int target) { vector <int> res; for (int i = 0; i < nums.size() - 1; i++) { for (int j = i+1; j <