leetcode 704

[Leetcode] 0674. 最长连续递增序列

674. 最长连续递增序列 题目描述 给定一个未经排序的整数数组,找到最长且 连续递增的子序列,并返回该序列的长度。 连续递增的子序列 可以由两个下标 l 和 r(l )确定,如果对于每个 l ,都有 nums[i] ,那么子序列 [nums[l], nums[l + 1], ..., nums[r ......
序列 Leetcode 0674

[Leetcode] 0661. 图片平滑器

661. 图片平滑器 题目描述 图像平滑器 是大小为 3 x 3 的过滤器,用于对图像的每个单元格平滑处理,平滑处理后单元格的值为该单元格的平均灰度。 每个单元格的 平均灰度 定义为:该单元格自身及其周围的 8 个单元格的平均值,结果需向下取整。(即,需要计算蓝色平滑器中 9 个单元格的平均值)。 ......
Leetcode 图片 0661

[LeetCode] 649. Dota2 Senate

In the world of Dota2, there are two parties: the Radiant and the Dire. The Dota2 senate consists of senators coming from two parties. Now the Senate ......
LeetCode Senate Dota2 Dota 649

LeetCode/简化路径

简化unix文件路径 ####1. 分割提取+栈 class Solution { public: string simplifyPath(string path) { vector<string> names = split(path, '/');//消除/并得到待处理的多段文件名 vector< ......
路径 LeetCode

[Leetcode] 0657. 机器人能否返回原点

657. 机器人能否返回原点 题目描述 在二维平面上,有一个机器人从原点 (0, 0) 开始。给出它的移动顺序,判断这个机器人在完成移动后是否在 (0, 0) 处结束。 移动顺序由字符串 moves 表示。字符 move[i] 表示其第 i 次移动。机器人的有效动作有 R(右),L(左),U(上)和 ......
原点 机器人 Leetcode 机器 0657

[Leetcode] 0001. 两数之和

1.两数之和 题目描述 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。 你可以按任意顺序返回答案。 示例 1: 输入: ......
之和 Leetcode 0001

LeetCode 双周赛 103(2023/04/29)区间求和的树状数组经典应用

本文已收录到 AndroidFamily,技术和职场问题,请关注公众号 [彭旭锐] 提问。 大家好,我是小彭。 这场周赛是 LeetCode 双周赛第 103 场,难得在五一假期第一天打周赛的人数也没有少太多。这场比赛前 3 题比较简单,我们把篇幅留给最后一题。 往期周赛回顾:LeetCode 单周 ......
数组 区间 LeetCode 经典 2023

LeetCode -- 递归 dfs、回溯

22. 括号生成 class Solution { public List<String> generateParenthesis(int n) { List<String> result = new ArrayList(); if (n == 0) { return result; } // 必须 ......
LeetCode dfs

[LeetCode] 1003. Check If Word Is Valid After Substitutions

Given a string s, determine if it is valid. A string s is valid if, starting with an empty string t = "", you can transform t into s after performing ......
Substitutions LeetCode Check After Valid

Leetcode1~10题整理

1. 两数之和 哈希表:O(n) class Solution { public: vector<int> twoSum(vector<int>& nums, int target) { unordered_map<int, int> hs; int n = nums.size(); for(int ......
Leetcode1 Leetcode 10

LeetCode 链表操作

21. 合并两个有序链表 /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int val) { this ......
LeetCode

7-005-(LeetCode- 91) 解码方法

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
LeetCode 方法 005 91

7-010-(LeetCode- 322) 零钱兑换

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
零钱 LeetCode 010 322

7-013-(LeetCode- 494) 目标和

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
LeetCode 目标 013 494

7-015-(LeetCode- 42) 接雨水

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
雨水 LeetCode 015 42

7-006-(LeetCode- 152) 乘积最大子数组

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
乘积 数组 LeetCode 006 152

7-007-(LeetCode- 198) 打家劫舍

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
打家劫舍 LeetCode 007 198

7-008-(LeetCode- 300) 最长递增子序列

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
序列 LeetCode 008 300

7-014-(LeetCode- 718) 最长重复子数组

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
数组 LeetCode 014 718

7-011-(LeetCode- 337) 打家劫舍Ⅲ

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
打家劫舍 LeetCode 011 337

7-012-(LeetCode- 416) 分割等和子集

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
子集 LeetCode 012 416

7-009-(LeetCode- 309) 最佳买卖股票时机含冷冻期

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
时机 LeetCode 股票 009 309

7-003-(LeetCode- 62) 不同路径

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
路径 LeetCode 003 62

7-004-(LeetCode- 64) 最小路径和

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
路径 LeetCode 004 64

7-002-(LeetCode- 5) 最长回文子串

1. 题目 读题 考查点 2. 解法 思路 代码逻辑 具体实现 1 1 3. 总结 ......
回文 LeetCode 002

LeetCode/移动石子直到连续

###1. 移动石子直到连续(三个石子) class Solution { public: vector<int> numMovesStones(int a, int b, int c) { int x = min({a, b, c}); int z = max({a, b, c}); int y ......
石子 LeetCode

[LeetCode] 1033. Moving Stones Until Consecutive

There are three stones in different positions on the X-axis. You are given three integers a, b, and c, the positions of the stones. In one move, you p ......
Consecutive LeetCode Moving Stones Until

leetcode_D10_136只出现一次的数字

1.题目 2.解一 leetcode官方解法,主要用到了两个知识:第一个是reduce函数,需要注意的是在python3中,需要 通过“ from functools import reduce ”从模块中调用该函数;第二个知识是位运算中的异或运算,主要有以下计算法则。 有了这两个补充知识,该题目就 ......
leetcode_D leetcode 数字 136 10

2023-04-28 LeetCode精选题目20道附我的Java实现

LeetCode精选题目20道 1.56.合并区间 贪心 给出一个区间的集合,请合并所有重叠的区间。 示例 1: 输入: intervals = [[1,3],[2,6],[8,10],[15,18]] 输出: [[1,6],[8,10],[15,18]] 解释: 区间 [1,3] 和 [2,6] ......
LeetCode 题目 2023 Java 04

C语言刷leetcode——并查集

概述 https://leetcode.cn/problems/number-of-provinces/solution/python-duo-tu-xiang-jie-bing-cha-ji-by-m-vjdr/ 基本概念 并查集是一种数据结构 并查集这三个字,一个字代表一个意思。 并(Union ......
leetcode 语言