hard-leetcode leetcode hard 25

25.什么情况下会发生布尔值的隐式强制类型转换

#### 25. 什么情况下会发生布尔值的隐式强制类型转换? ``` (1) if (..) 语句中的条件判断表达式。 (2) for ( .. ; .. ; .. ) 语句中的条件判断表达式(第二个)。 (3) while (..) 和 do..while(..) 循环中的条件判断表达式。 (4) ......
布尔 类型 情况 25

LeetCode 354. Russian Doll Envelopes 排序+LIS

You are given a 2D array of integers `envelopes` where `envelopes[i] = [wi, hi]` represents the width and the height of an envelope. One envelope can ......
Envelopes LeetCode Russian Doll 354

LeetCode 519. Random Flip Matrix 哈希Map

There is an `m x n` binary grid matrix with all the values set 0 initially. Design an algorithm to randomly pick an index `(i, j)` where `matrix[i][j] ......
LeetCode Random Matrix Flip 519

LeetCode 239. 滑动窗口最大值

``` class Solution { public: vector maxSlidingWindow(vector& nums, int k) { deque q; vector res; for(int i=0;i=k) q.pop_front(); //插入新元素 while(q.size( ......
最大值 LeetCode 239

【物联网】物联网时代25大开源IoT框架(二)

## 00. 目录 @[toc] 声明:原文来自以下参考链接 链接: [物联网时代25大开源IoT框架(二)](https://mp.weixin.qq.com/s?__biz=Mzg3Nzk1NjQ5NA==&mid=2247484151&idx=1&sn=af0dd00090f3e9793d13 ......
框架 时代 IoT

LeetCode 剑指 Offer 13. 机器人的运动范围

#题目链接:[LeetCode 剑指 Offer 13. 机器人的运动范围](https://leetcode.cn/problems/ji-qi-ren-de-yun-dong-fan-wei-lcof/) ##题意: **地上有一个m行n列的方格,从坐标 [0,0] 到坐标 [m-1,n-1] ......
机器人 LeetCode 范围 机器 Offer

Min25-筛

title: Min25 筛 feature: false mathjax: true date: 2022-09-07 10:44:26 tags: - 数论 categories: Math cover: https://pic.imgdb.cn/item/63192eea16f2c2beb1a ......
Min 25

leetcode day2 977 209 59

[toc] #977 ##暴力法 直接数组中每个元素平方后用sort进行排序 ##双指针法 数组是有序的,平方后最大的元素存在于nums的两端,所以就定义两个指向两端的指针, 然后比较两端绝对值的大小,大的加入新定义的ans数组,并且指针向内移动 ``` vector ans (nums.size( ......
leetcode day2 day 977 209

Leetcode238. 除自身以外数组的乘积

``` class Solution { public: vector productExceptSelf(vector& nums) { vector q; int t=1; for(auto i:nums) { q.push_back(t); t*=i; } t=1; for(int i=num ......
乘积 数组 Leetcode 238

LeetCode -- 787. K 站中转内最便宜的航班

有边数限制的最短路 1、动态规划 f[i][j]表示恰好通过i次,从起点到大j这个点的最短路径。 class Solution { private: static constexpr int INF = 10000 * 101 + 1; public: int findCheapestPrice(i ......
航班 LeetCode 787

[LeetCode] 2542. Maximum Subsequence Score

You are given two 0-indexed integer arrays nums1 and nums2 of equal length n and a positive integer k. You must choose a subsequence of indices from n ......
Subsequence LeetCode Maximum Score 2542

leetcode-20. 有效的括号

https://leetcode.cn/problems/valid-parentheses/ 20. 有效的括号 给定一个只包括 '(',')','{','}','[',']' 的字符串 s ,判断字符串是否有效。 有效字符串需满足: 左括号必须用相同类型的右括号闭合。 左括号必须以正确的顺序闭合 ......
括号 leetcode 20

[LeetCode] 931. Minimum Falling Path Sum

Given an n x n array of integers matrix, return the minimum sum of any falling path through matrix. A falling path starts at any element in the first ......
LeetCode Falling Minimum Path 931

LeetCode —— 子串

560. 和为 K 的子数组(哈希表) 官方题解:https://leetcode.cn/problems/subarray-sum-equals-k/solution/he-wei-kde-zi-shu-zu-by-leetcode-solution/ 假设 left 到 right 下标的子数组 ......
LeetCode

LeetCode —— 哈希表

128. 最长连续序列 不要求在位置数组中是连续的 输入:nums = [100,4,200,1,3,2] 输出:4 解释:最长数字连续序列是 [1, 2, 3, 4]。它的长度为 4。 两种最朴素的解法之一: 先排序,从前往后找最长连续上升序列即可。该思路简单有效,但是复杂度已经至少有 O(nlo ......
LeetCode

Leetcode - 动态规划总结(必看!!!)

一、labuladong动态规划模板思路 wiki:https://labuladong.gitee.io/algo/di-ling-zh-bfe1b/dong-tai-g-1e688/ 题目: 动态规划模板思路: 二、我自己如何理解【状态】【选择】 以714题目《最佳时机去买卖股票+手续费》为例子 ......
Leetcode 动态

LeetCode 热题 100 之 283. 移动零

#题目描述 给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。 请注意 ,必须在不复制数组的情况下原地对数组进行操作。 示例 1: 输入: nums = [0,1,0,3,12] 输出: [1,3,12,0,0] 示例 2: 输入: nums = [0] ......
LeetCode 100 283

leetcode206反转链表

每个节点的next只有一个 因为要反转。必定需要存储之前的节点。 而现在的节点要根据原来的next进行更新,因为now->next已经更新为前面的节点,所以要先存储之前的now->next ListNode* pre=nullptr;//每个链表结尾都要使用nullptr ListNode* now ......
leetcode 206

LeetCode 剑指 Offer 11. 旋转数组的最小数字

#题目链接:[LeetCode 剑指 Offer 11. 旋转数组的最小数字](https://leetcode.cn/problems/xuan-zhuan-shu-zu-de-zui-xiao-shu-zi-lcof/?envType=study-plan-v2&envId=coding-int ......
数组 LeetCode 数字 Offer 11

LeetCode 剑指 Offer 12. 矩阵中的路径

#题目链接:[LeetCode 剑指 Offer 12. 矩阵中的路径](https://leetcode.cn/problems/ju-zhen-zhong-de-lu-jing-lcof/?envType=study-plan-v2&envId=coding-interviews) ##题意: ......
矩阵 路径 LeetCode Offer 12

LeetCode 234. 回文链表

``` class Solution { public: ListNode* reverse(ListNode* head)//翻转以head为头节点的链表 { if(!head||!head->next) return head; auto a=head,b=head->next; while(b ......
回文 LeetCode 234

LeetCode -- 918. 环形子数组的最大和

遇到环形问题一般有两种考虑方法: 1.破环成链 2.分为数组中间部分和数组两边部分分别考虑 本题采用第二种考虑方法,将原数组分为中间部分和两边部分分别考虑。中间部分即为子数组最大和,两边部分计总和减去中间部分最小和。 class Solution { public: int maxSubarrayS ......
环形 数组 LeetCode 918

LeetCode 热题 100 之 128. 最长连续序列

#题目描述 给定一个未排序的整数数组 nums ,找出数字连续的最长序列(不要求序列元素在原数组中连续)的长度。 请你设计并实现时间复杂度为 **O(n)**的算法解决此问题。 示例 1: 输入:nums = [100,4,200,1,3,2] 输出:4 解释:最长数字连续序列是 [1, 2, 3, ......
序列 LeetCode 100 128

[论文速览] Hard Patches Mining for Masked Image Modeling

## Pre title: Hard Patches Mining for Masked Image Modeling accepted: CVPR 2023 paper: https://arxiv.org/abs/2304.05919 code: https://github.com/Haoch ......
Modeling Patches Mining Masked 论文

LeetCode -- 826. 安排工作以达到最大收益

方法一:二分加枚举 通过二分快速查找小于某个难度值的最大价值。 class Solution { public: int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) { ......
收益 LeetCode 826

7-11 leetcode 2612

请你编写一个异步函数,它接收一个正整数参数 millis ,并休眠这么多毫秒。要求此函数可以解析任何值。 ps: promise 期约函数 (异步函数)的使用 ,promise 是一个对象 new promise /** * @param {number} millis */ async funct ......
leetcode 2612 11

7-11 leetcode 2619

请你编写一段代码实现一个数组方法,使任何数组都可以调用 array.last() 方法,这个方法将返回数组最后一个元素。如果数组中没有元素,则返回 -1 。 ps:this 环境变量的使用 ,this.length 的返回值是数字类型 代码实现: <script> //在数组的原型写扩展方法可以给所 ......
leetcode 2619 11

LeetCode 剑指 Offer 08. 二叉树的下一个节点

## 题目:二叉树的下一个节点 **给定一棵二叉树的其中一个节点,请找出中序遍历序列的下一个节点。(树的后继)** **注意:** - **如果给定的节点是中序遍历序列的最后一个,则返回空节点;** - **二叉树一定不为空,且给定的节点一定不是空节点;** ## 解题思路 ![](https:// ......
节点 LeetCode Offer 08

LeetCode 剑指 Offer 04. 二维数组中的查找

#题目链接:[LeetCode 剑指 Offer 04. 二维数组中的查找](https://leetcode.cn/problems/er-wei-shu-zu-zhong-de-cha-zhao-lcof/) ##题意: **在一个 n * m 的二维数组中,每一行都按照从左到右 非递减 的顺序 ......
数组 LeetCode Offer 04

【线段树】【leetcode 729. 我的日程安排表 I】

class MyCalendar { class Seg { int l; int r; boolean val; Seg left; Seg right; public Seg(int x, int y) { this.l = x; this.r = y; this.val = false; th ......
线段 安排表 日程 leetcode 729