rectangle leetcode number ships

leetcode 21. 合并两个有序链表

## 直接合并即可 这道题是简单题,直接合并即可 /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int ......
leetcode 两个 21

[LeetCode] 1071. Greatest Common Divisor of Strings

For two strings s and t, we say "t divides s" if and only if s = t + ... + t (i.e., t is concatenated with itself one or more times). Given two string ......
LeetCode Greatest Divisor Strings Common

[LeetCode] 1186. Maximum Subarray Sum with One Deletion

Given an array of integers, return the maximum sum for a non-empty subarray (contiguous elements) with at most one element deletion. In other words, y ......
LeetCode Deletion Subarray Maximum 1186

[LeetCode] 2462. Total Cost to Hire K Workers

You are given a 0-indexed integer array costs where costs[i] is the cost of hiring the ith worker. You are also given two integers k and candidates. W ......
LeetCode Workers Total 2462 Cost

系统断电后,MySQL重启失败:[ERROR] Binlog has bad magic number; It‘s not a binary log file that can be used by this version of MySQL

系统断电后,MySQL重启失败: [ERROR] Binlog has bad magic number; It‘s not a binary log file that can be used by this version of MySQL [ERROR] Can't init tc log [ ......
MySQL version Binlog binary number

LeetCode —— 滑动窗口

904. 水果成篮 用一个 Map 记录当前窗口的情况: key - 水果种类数 value - 这个水果种类在当前滑动窗口里出现的次数 维持一个 left 指针到 right 指针的滑动窗口 每次 right 右移一位,将新加入窗口的 fruits[right] 这个种类放到 map 里,并将该种 ......
LeetCode

[LeetCode] 2485. Find the Pivot Integer

Given a positive integer n, find the pivot integer x such that: The sum of all elements between 1 and x inclusively equals the sum of all elements bet ......
LeetCode Integer Pivot 2485 Find

LeetCode 128. 最长连续序列

* 为什么这题我都不会,脑袋有点累,状态真差 ``` class Solution { public: int longestConsecutive(vector& nums) { unordered_set s(nums.begin(),nums.end());//记录数字是否出现过 int re ......
序列 LeetCode 128

leetcode-前缀和数组&差分数组

前缀和数组: 前缀和技巧适用于快速、频繁地计算一个索引区间内的元素之和。(仅仅适用于原数组不变的情况,如果原数组经常修改,则需要考虑差分数组。) 看两道例题就清楚了: 1. 303. 区域和检索 - 数组不可变 - 力扣(LeetCode) 由于要频繁计算某个区间内的元素之和,暴力解法复杂度太大,显 ......
数组 前缀 leetcode amp

LeetCode 周赛 351(2023/06/25)T2 有点意思

> **本文已收录到 [AndroidFamily](https://github.com/pengxurui/AndroidFamily),技术和职场问题,请关注公众号 [彭旭锐] 和 [BaguTree Pro] 知识星球提问。** - 往期回顾:[LeetCode 单周赛第 348 场 · 数 ......
LeetCode 意思 2023 351 06

LeetCode 双周赛 107(2023/06/24)滑动窗口与离散化

> **本文已收录到 [AndroidFamily](https://github.com/pengxurui/AndroidFamily),技术和职场问题,请关注公众号 [彭旭锐] 和 [BaguTree Pro] 知识星球提问。** - 往期回顾:[LeetCode 单周赛第 348 场 · 数 ......
LeetCode 2023 107 06 24

【Leetcode每日一题】判定是否互为字符重排

题目 思路 思路比较简单,作两个长度为26的数组,用来存储对应序列字母的个数。遍历完成后对比两个数组,根据是否存在相同序列位置字母个数不一样的情况来确定两个字符串是否都是由相同的字母构成的。 值得一提的是在一开始我忽略了“字母个数必须相同”这一条件。 代码 impl Solution { pub f ......
字符 Leetcode

二叉树-快排-leetcode912

给你一个整数数组 nums,请你将该数组升序排列。 示例 1: 输入:nums = [5,2,3,1] 输出:[1,2,3,5] 示例 2: 输入:nums = [5,1,1,2,0,0] 输出:[0,0,1,1,2,5] 提示: 1 = hi) { return; } // 对 nums[lo.. ......
leetcode 912

[Leetcode] 0026. 删除有序数组中的重复项

# [26. 删除有序数组中的重复项](https://leetcode.cn/problems/remove-duplicates-from-sorted-array) 点击上方,跳转至Leetcode ## 题目描述 给你一个 升序排列 的数组 nums ,请你 原地 删除重复出现的元素,使每个 ......
数组 Leetcode 0026

[Leetcode] 0026.删除有序数组中的重复项

# [26. 删除有序数组中的重复项](https://leetcode.cn/problems/remove-duplicates-from-sorted-array) [English Version](/solution/0000-0099/0026.Remove%20Duplicates%2 ......
数组 Leetcode 0026

[Leetcode] 0021. 合并两个有序链表

# [21. 合并两个有序链表](https://leetcode.cn/problems/merge-two-sorted-lists) 点击上方,跳转至Leetcode ## 题目描述 将两个升序链表合并为一个新的 升序 链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。 示例 1: ......
Leetcode 两个 0021

【LeetCode摩尔投票】有趣的简单题:数组中出现次数超过一半的数字

### 数组中出现次数超过一半的数字 https://leetcode.cn/problems/shu-zu-zhong-chu-xian-ci-shu-chao-guo-yi-ban-de-shu-zi-lcof/ 数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字。 你可以假设数组是非 ......
数组 LeetCode 次数 数字

[leetcode]114. 二叉树展开为链表

总结:怎样写递归函数?关键是把递归函数的功能定义清楚,并在递归函数体中使用自身来做事,此时不要关注递归函数执行的细节。也就是写高层级代码的时候不要关注低层级的事情,这就叫抽象。关注也没有用,想不清楚的。 1 class Solution { 2 public void flatten(TreeNod ......
leetcode 114

LeetCode/子集、组合

###一 . 子集 给你一个整数数组 nums ,数组中的元素 互不相同,返回该数组所有可能的子集 #### 1. 回溯法 对每个数做选择,放入当前位,同时固定访问顺序,只访问下标更大的数,避免重复 回溯法 ``` class Solution { public: vector> res; vect ......
子集 LeetCode

leetcode5最:长回文子串

动态规划: 1个回文串,两边加上同样的字符,也是回文串。这是一个性质,之后要用。 对于一大串字符,从1长度的子串开始判断。 1个长度的子串,肯定回文;如果这个子串两边加上同样的字符,长度变成了3,少了一次判断。 因此还要加上,判断2长度的子串是不是回文。 之后才会判断3长度的子串是不是回文。 以此类 ......
回文 leetcode5 leetcode

LeetCode/特别的排列

给你一个下标从 0 开始的整数数组 nums ,它包含 n 个 互不相同 的正整数。如果 nums 的一个排列满足以下条件,我们称它是一个特别的排列: 对于 0 & nums) { int mod = 1e9+7; int m = nums.size(); int memo[m][m f = [&] ......
LeetCode

做leetcode算法题的一些感受

leetcode题目做了34道了,写下目前的感受,不一定对,需要经常修改内容。 1、代码是怎么写出来的?不是一下子写出来的,是逐步填充,逐步具体的。一句话,写代码也要看到历史和现状,现状不是突然出现的,是有发展历史的。不是从1直接就到10了,而是从1->2->3,逐步递进,最后到10。写代码总要写第 ......
算法 leetcode

Leetcode: Arrays.sort() - comparator

Arrays.sort(points,(o1,o2)->{ if(o1[1] == o2[1]) return 0; if(o1[1] < o2[1]) return -1; return 1; }) 根据dp[1]进行升序排列,O(NlogN) ......
comparator Leetcode Arrays sort

LeetCode--矩形走位

59. 螺旋矩阵 II 定义一个总数,是所有格子走完中心的最大数,target = n*n 从 1 开始,每走一步,当前数 +1 ,while(curNum<=target) 就继续走 定义每圈螺旋走位的边界,初始值:left=0; right=n-1; top=0; bottom=n-1; 1、在 ......
矩形 LeetCode

leetcode 338. 比特位计数

#### [338. 比特位计数](https://leetcode.cn/problems/counting-bits/) 难度简单 1216 给你一个整数 `n` ,对于 `0 0 1 --> 1 2 --> 10 **示例 2:** **输入:**n = 5 **输出:**[0,1,1,2,1 ......
leetcode 338

leetcode 283. 移动零

#### [283. 移动零](https://leetcode.cn/problems/move-zeroes/) 难度简单 给定一个数组 `nums`,编写一个函数将所有 `0` 移动到数组的末尾,同时保持非零元素的相对顺序。 **请注意** ,必须在不复制数组的情况下原地对数组进行操作。 ** ......
leetcode 283

什么是 ABAP 的 Message Class,Message Number 和 Message Text 试读版

ABAP 编程语言里的 Message(消息)是 SAP 产品里及其重要的一个概念,因为 Message 是 SAP 应用在运行过程中,向终端用户提供运行反馈的最重要的交互渠道之一。 当用户使用 SAP 产品过程中,如果遇到各种错误或者提示消息,会根据这些消息,查询文档或者咨询 SAP 支持人员,以 ......
Message Number Class ABAP Text

[LeetCode] 面试题 16.19. 水域大小

你有一个用于表示一片土地的整数矩阵land,该矩阵中每个点的值代表对应地点的海拔高度。若值为0则表示水域。由垂直、水平或对角连接的水域为池塘。池塘的大小是指相连接的水域的个数。编写一个方法来计算矩阵中所有池塘的大小,返回值需要从小到大排序。 示例: 输入:[ [0,2,1,0], [0,1,0,1] ......
水域 LeetCode 大小 16 19

[Leetcode] 0014. 最长公共前缀

# [14. 最长公共前缀](https://leetcode.cn/problems/longest-common-prefix) 点击上方,跳转至Leetcode ## 题目描述 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串 ""。 示例 1: 输入:strs ......
前缀 Leetcode 0014

[Leetcode] 0020. 有效的括号

# [20. 有效的括号](https://leetcode.cn/problems/valid-parentheses) 点击上方,跳转至leetcode ## 题目描述 给定一个只包括 '(',')','{','}','[',']' 的字符串 s ,判断字符串是否有效。 有效字符串需满足: 左括 ......
括号 Leetcode 0020