自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 资源 (1)
  • 收藏
  • 关注

原创 2021-02-16

2021-02-16 Leetcode每日刷题感觉今天的题目甚至没有必要写题目给定长度为 2n 的整数数组 nums ,你的任务是将这些数分成 n 对, 例如 (a1, b1), (a2, b2), …, (an, bn) ,使得从 1 到 n 的 min(ai, bi) 总和最大。返回该 最大总和 。示例 1:输入:nums = [1,4,3,2]输出:4解释:所有可能的分法(忽略元素顺序)为:(1, 4), (2, 3) -> min(1, 4) + min(2, 3) =

2021-02-16 00:17:57 59

原创 2021-02-15

2021-02-15 Leetcode每日刷题题目一给定一个二进制数组, 计算其中最大连续1的个数。示例 1:输入: [1,1,0,1,1,1]输出: 3解释: 开头的两位和最后的三位都是连续1,所以最大连续1的个数是 3.注意:输入的数组只包含 0 和1。 输入数组的长度是正整数,且不超过 10,000。我的代码:class Solution: def findMaxConsecutiveOnes(self, nums: List[int]) -> int:

2021-02-15 23:56:04 65

原创 2021-02-14

2021-02-14 Leetcode每日刷题题目N couples sit in 2N seats arranged in a row and want to hold hands. We want to know the minimum number of swaps so that every couple is sitting side by side. A swap consists of choosing any two people, then they stand up and swi

2021-02-14 23:50:14 56

原创 2021-02-13

2021-02-13 Leetcode每日一题题目Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in this array.Could you do it without extra spac

2021-02-13 23:56:39 116

原创 2021-02-12

2021-02-12 Leetcode每日刷题题目Given an integer rowIndex, return the rowIndexth row of the Pascal’s triangle.Notice that the row index starts from 0.In Pascal’s triangle, each number is the sum of the two numbers directly above it.Follow up: Could you op

2021-02-12 16:52:47 104

原创 2021-02-11

2021-02-11 Leetcode每日刷题题目Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element.Implement KthLargest class:KthLargest(int k, int[] nums) Initializes the ob

2021-02-11 16:14:36 116

原创 2021-02-10

2021-02-10 Leetcode每日刷题题目给定两个字符串 s1 和 s2,写一个函数来判断 s2 是否包含 s1 的排列。换句话说,第一个字符串的排列之一是第二个字符串的子串。示例1:输入: s1 = “ab” s2 = “eidbaooo”输出: True解释: s2 包含 s1 的排列之一 (“ba”).示例2:输入: s1= “ab” s2 = “eidboaoo”输出: False我的思路首先根据之前几天的题目知道这是一个滑动窗口题。我的想法是套用昨天的基

2021-02-10 20:51:22 78

原创 2021-02-09

2021-02-09 Leetcode每日刷题题目给定一个正整数数组 A,如果 A 的某个子数组中不同整数的个数恰好为 K,则称 A的这个连续、不一定独立的子数组为好子数组。例如,[1,2,3,1,2] 中有 3 个不同的整数:1,2,以及 3。返回 A 中好子数组的数目。示例一:输入:A = [1,2,1,2,3], K = 2输出:7解释:恰好由 2 个不同整数组成的子数组:[1,2], [2,1], [1,2], [2,3], [1,2,1], [2,1,2], [1,2,1,2

2021-02-09 23:45:03 82

原创 2021-02-08

2021-2-8 Leetcode每日刷题题目当 A 的子数组 A[i], A[i+1], …, A[j] 满足下列条件时,我们称其为湍流子数组:若 i <= k < j,当 k 为奇数时, A[k] > A[k+1],且当 k 为偶数时,A[k] < A[k+1];或 若 i <= k < j,当 k 为偶数时,A[k] > A[k+1] ,且当 k 为奇数时, A[k] < A[k+1]。也就是说,如果比较符号在子数组中的每个相邻元素对之间

2021-02-08 17:19:56 124

原创 2021-2-7 Leetcode每日刷题

2021-2-7 Leetcode每日刷题题目给你一个长度为 n 的整数数组,请你判断在 最多 改变 1 个元素的情况下,该数组能否变成一个非递减数列。我们是这样定义一个非递减数列的: 对于数组中所有的 i (0 <= i <= n-2),总满足 nums[i] <= nums[i + 1]。示例 1:输入: nums = [4,2,3]输出: true解释: 你可以通过把第一个4变成1来使得它成为一个非递减数列。示例 2:输入: nums = [4,2,1]

2021-02-07 11:24:26 175

石墨文档应用程序

一款可以多人在线同时修改文档的程序,构造原型的好工具。

2018-11-07

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除