leetcode winner array 1535

[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

2022 杭电多校 第十场 1001 Winner Prediction(最大流)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=7244 杭电题解:先让 1号选手赢下所有和他有关的比赛,设此时选手赢了a场比赛。如果存在某个 ai> a1 则1号选手不可能成为冠军。否则选手至多还能再赢bi = a1 - ai 场比赛。考虑建立一张网络 ......
Prediction Winner 2022 1001

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

[Javascript] Avoid mutation, Array.prototype.toReversed() vs reverse()

reverse()mutates the original array, return the reference point to the original array. The toReversed() method of Array instances is the copying count ......

[Javascript] avoid mutation: Array.prototype.toSpliced() vs splice()

Array.prototype.splice()mutates the original array. To avoid mutation, we use Array.prototype.slice(). new method Array.prototype.toSpliced() return a ......

[Javascript] Avoid mutation, Array.prototype.toSorted() vs sort()

sort(), mutates the original array, and return the reference to original array and sorted. The toSorted() method of Array instances is the copying ver ......
Javascript prototype mutation toSorted Avoid

[Javascript] Array.prototype.with

Prevously, when we want to upate an item inside a array: const items = [ {id: 1, name: 'a'}, {id: 2, name: 'b'}, {id: 3, name: 'c'}, {id: 4, name: 'd' ......
Javascript prototype Array with

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 语言

vscode-leetcode

vscode 里写 leetcode 需要的插件xavier-cai.vscode-leetcode-cpp-debug, leetcode.vscode-leetcode LeetCode C++ Debugger.Delete Temporary Contents置为false ctrl+shi ......
vscode-leetcode leetcode vscode

LeetCode 241 为运算表达式设计优先级

LeetCode | 241.为运算表达式设计优先级 给你一个由数字和运算符组成的字符串 expression ,按不同优先级组合数字和运算符,计算并返回所有可能组合的结果。你可以 按任意顺序 返回答案。 生成的测试用例满足其对应输出值符合 32 位整数范围,不同结果的数量不超过 104 。 示例 ......
优先级 表达式 LeetCode 241

【二分查找】LeetCode 153. 寻找旋转排序数组中的最小值

题目链接 153. 寻找旋转排序数组中的最小值 思路 首先分析一下旋转数组可能有的状态: 左 < 中 < 右,此时最小值肯定在左边,应当收缩右边界 左 < 中,中 > 右,此时最小值肯定在右半段,应当收缩左边界 左 > 中,中 < 右,此时最小值肯定在左半段,应当收缩右边界 分析这三种状态可以发现, ......
数组 LeetCode 153