1.两个数组的交集2 给定两个数组,编写一个函数来计算它们的交集。 示例 1: 输入: nums1 = [1,2,2,1], nums2 = [2,2] ...
链接:https: leetcode.com tag sort Merge Intervals 年 月 日,谷歌tag复习 合并区间 题解:先按照interval的begin从小到大sort一下,然后顺序遍历,能合并的就合并,不能合并的就加入一个新的interval。 View Code Insert Interval 年 月 日,谷歌tag复习 Given a set ofnon overla ...
2019-02-23 23:28 0 1035 推荐指数:
1.两个数组的交集2 给定两个数组,编写一个函数来计算它们的交集。 示例 1: 输入: nums1 = [1,2,2,1], nums2 = [2,2] ...
Sort a linked list in O(n log n) time using constant space complexity. Example 1: Example 2: 常见排序方法有很多,插入排序,选择排序,堆排序,快速排序,冒泡排序,归并排序,桶排序 ...
Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3] ...
Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3].... Example: 这道题让我们求摆动排序 ...
Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors ...
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red ...
题目: 括号匹配,就是给定的字符串中,只有"{ 、}、 [、 ] (、)"这几种字符,其中有效字符串需满足: 左括号必须用相同类型的右括号闭合。 左括号必须以正确的顺序闭合。 空字符 ...
前言 正值端午佳节,LeetCode也很懂。这两天都是简单题,早点做完去包粽子。 故事从一道简单题说起 第一个错误的版本 简单题 简单题,所以重拳出击,简单分析:产品版本号是1到n,如果每个版本都调用一个isBadVersion函数,将结果放入数组中,则为:[false ...