”���LeetCode“ 的搜索结果

     栈和队列相关问题栈的基础应用20. 有效的括号题目描述方法1 基础栈的应用方法2 将右括号入栈 加速150. 逆波兰表达式求值题目描述方法1三级目录 栈的基础应用 20. 有效的括号 题目描述 方法1 基础栈的应用 ...

     Question: Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks. Tasks could be done without original order....

     Question: Given a collection of intervals, merge all overlapping intervals. Example: Input: [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] ov...

     Question Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: getand put. get(key)- Get the value (will always be positive) of the key...

     Question: Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tickets belong to a man who departs from JFK...

     Question: Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters 1 or 0. Example 1: Input: a = “11”, b = “1” ...

     Question Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidateswhere the candidate numbers sums to target. ...

     给定一个范围在 1 ≤ a[i] ≤ n ( n = 数组大小 ) 的 整型数组,数组中的元素一些出现了两次,另一些只出现一次。 找到所有在 [1, n] 范围之间没有出现在数组中的数字。 您能在不使用额外空间且时间复杂度为O(n)的...

     题目传送门 题意: 在一个由 ‘0’ 和 ‘1’ 组成的二维矩阵(n*m)内,找到只包含 ‘1’ 的最大正方形,并返回其面积。 题解: 主要思路就是正方形的对角线,比如现在已经有一个正方形的区域,那么在该正方形的基础...

     Question: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest p...

     328.奇偶链表 难度 : 中等 给定一个单链表,把所有的...来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/odd-even-linked-list 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。

     Question: Given a sequence of n integers a1, a2, …, an, a 132 pattern is a subsequence ai, aj, ak such that i < j < k and ai < ak < aj. Design an algorithm that takes a ...

     判断数组存在重复元素 题目 给定一个整数数组,判断是否存在重复元素。 如果任意一值在数组中出现至少两次,函数返回 true 。如果数组中每个元素都不相同,则返回 false 。 思路 一开始的思路是先快排,变有序后再...

     Question Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string “”. Example 1 Input: [“flower”,“flow”,...

     Question: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. The above elevation map is represented...

     Question: Given a board with m by n cells, each cell has an initial state live (1) or dead (0). Each cell interacts with its eight neighbors (horizontal, vertical, diagonal) using the following four r...

     Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get

     Question: Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: Input: [2,3,-2,4] Output: 6 ...

     Question: Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each in...

     Question: Sort a linked list using insertion sort. Algorithm of Insertion Sort: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. ...

     Question: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To represent a cycle in the given linked list, we use an integer pos which represents the posi...

     Question: Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Input: 1->2->3->4->5->NULL, m = 2, n = 4 ...g...

10  
9  
8  
7  
6  
5  
4  
3  
2  
1