总和leetcode 39
[刷题记录Day16]Leetcode二叉树
# No.1 ## 题目 [二叉树的最大深度](https://leetcode.cn/problems/maximum-depth-of-binary-tree/) ## 思路 - 递归 - 其实是后序遍历的方式 ## 代码 ```Java public int maxDepth(TreeNode ......
[刷题记录Day17]Leetcode二叉树
# No.1 ## 题目 [平衡二叉树](https://leetcode.cn/problems/balanced-binary-tree/) ## 思路 - 递归法 - 在遍历中比较左右子树的高度差 ## 递归分析 1. **参数**:当前传入节点。 **返回值**:以当前传入节点为根节点的树的 ......
[刷题记录Day18]Leetcode二叉树
# No.1 ## 题目 [找树左下角的值](https://leetcode.cn/problems/find-bottom-left-tree-value/) ## 思路 - 队列,层序遍历 - Deque既可以用作栈也可以用作队列,谨慎使用 ## 代码 ```Java public int f ......
[刷题记录Day11]Leetcode
# No.1 ## 题目 [有效的括号](https://leetcode.cn/problems/valid-parentheses/) ## 思路 - 奇数个符号一定不符合 - 分析括号不匹配的可能性 - 第一种情况,字符串里左方向的括号多余了 ,所以不匹配 ![[brackets0.png]] ......
[刷题记录Day13]Leetcode
# No.1 ## 题目 [滑动窗口最大值](https://leetcode.cn/problems/sliding-window-maximum/) ## 思路 - 编写单调队列类 - [讲解](https://programmercarl.com/0239.%E6%BB%91%E5%8A%A8 ......
[刷题记录Day10]Leetcode
# No.1 ## 题目 [用栈实现队列](https://leetcode.cn/problems/implement-queue-using-stacks/) ## 思路 - 模拟 - 一个入栈一个出栈 ## 代码 ```Java class MyQueue { private Stack st ......
ModuleNotFoundError: No module named 'torch._six'
ModuleNotFoundError: No module named 'torch._six' 由于torch 2.0版本没有这个模块,因此,只需要降低torch版本,就可以解决。 1)新建一个虚拟环境 2)安装低版本torch REF https://blog.csdn.net/wzwddkb ......
[刷题记录Day8]Leetcode
# No.1 ## 题目 [反转字符串](https://leetcode.cn/problems/reverse-string/) ## 思路 - 双指针,从头尾向中间遍历 ## 代码 ```Java public void reverseString(char[] s) { char temp; ......
[刷题记录Day9]Leetcode
>建议跳过 # No.1 ## 题目 [找出字符串中第一个匹配项的下标](https://leetcode.cn/problems/find-the-index-of-the-first-occurrence-in-a-string/) ## 思路 - KMP ## 代码 ```Java ``` # ......
[刷题记录Day7]Leetcode哈希表
# No.1 ## 题目 [四数相加 II](https://leetcode.cn/problems/4sum-ii/) ## 思路 - 很妙的办法:有四个数组A、B、C、D,用hashMap记录【A、B中数字之和】+【这些和出现的次数】,再遍历C、D中数字组合,寻找【0-C、D中数字之和】在ha ......
[刷题记录Day6]Leetcode哈希表
# No.1 ## 题目 [有效的字母异位词](https://leetcode.cn/problems/valid-anagram/) ## 思路 - 每个字符频率都相同,于是把字母表映射到长度为26的数组上 ## 代码 ```Java public boolean isAnagram(Strin ......
VSCode使用JavaScript刷LeetCode配置教程(亲试可以!)
账号秘密都对,但是缺登录不成功的问题 诀窍可能是: 在属性设置中把LeetCode版本改成cn。点击LeetCode配置,修改Endpoint配置项,改成leetcode-cn,再次尝试登陆即可。 大家可移步原博文:https://blog.csdn.net/qq_37263248/article/ ......
leetcode1260
这是一道模拟题 刚开始准备纯模拟,而后在题解看到一维压缩,才发现其实是将矩阵按行展开后进行k次右移操作。 转换成一维后,难点就在转换坐标:行号 = idx / 列数;列号 = idx % 列数; ......
Autofac报错No constructors on type 'xxx' can be found with the constructor finder
**No constructors on type 'JK.TitanData.Repository.Fact_Sales_GMVTargetTotalRepository' can be found with the constructor finder 'Autofac.Core.Activat ......
[LeetCode][279]perfect-squares
# Content Given an integer n, return the least number of perfect square numbers that sum to n. A perfect square is an integer that is the square of an ......
leetcode236求最近公共祖先
递归 TreeNode* dfs(TreeNode* root,TreeNode* p,TreeNode* q){ if(!root)return root;//当发现这个节点已经是叶节点时,要告诉上层 if(root==p||root==q)return root;//当发现是p节点或者q时也要告 ......
Leetcode1636——按照频率将数组升序排序
给你一个整数数组 nums ,请你将数组按照每个值的频率 升序 排序。如果有多个值的频率相同,请你按照数值本身将它们 降序 排序。 请你返回排序后的数组。 示例 1: 输入:nums = [1,1,2,2,2,3] 输出:[3,1,1,2,2,2] 解释:'3' 频率为 1,'1' 频率为 2,'2 ......
【LeetCode动态规划#16】矩阵的最小路径和、三角形的最小路径和
### 矩阵的最小路径和 给定一个包含非负整数的 `*m* x *n*` 网格 `grid` ,请找出一条从左上角到右下角的路径,使得路径上的数字总和为最小。 **说明:**一个机器人每次只能向下或者向右移动一步。 **示例 1:** ``` 输入:grid = [[1,3,1],[1,5,1],[ ......
主从升级(mysql5.7.39-mysql8.0.25)
环境:OS:Centos 7当前数据库版本:5.7.39(主从目前启用了审计 server_audit.so,master_auto_position=1)计划升级的数据库版本:8.0.28 升级顺序:先升级从库 ########################从库机器上的操作########### ......
[LeetCode][221]maximal-square
# Content Given an m x n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example 1: Input: mat ......
[LeetCode][198]house-robber
# Content You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint s ......
vue3 报错 and 'localEnabled' does not exist in type 'ViteMockOptions'
报错:ReferenceError: require is not defined 原因: 通过命令行 pnpm install -D vite-plugin-mock mockjs 安装得vite-plugin-mock 之后发现再vite.config.ts里边报错 vue3+vite安装vit ......
【LeetCode动态规划#15】最长公共子序列II
### 最长公共子序列(二) #### 描述 给定两个字符串str1和str2,输出两个字符串的最长公共子序列。如果最长公共子序列为空,则返回"-1"。目前给出的数据,仅仅会存在一个最长的公共子序列 数据范围:0≤∣���1∣,∣���2∣≤20000≤∣*s**t**r*1∣,∣*s**t**r* ......
Spring源码搭建导依赖时报错:Failed to apply plugin 'kotlin'.
原因是kotlin插件的版本与gradle中指定的版本不一致,我的是1.8.0,spring5.3.x版本gradle配置文件指定的kotlin版本是1.5.32,修改成1.8.0 都有一 ......
Winter '24发布在即,Salesforce Flow中的最热功能不容错过!
Flow Builder作为自动化领域的新秀,它在功能方面已经远远超过Workflow Rules和Process Builder,随着Workflow Rules和Process Builder的退役,目前所有自动化都需要迁移到Flow。 Winter '24发布在即,Flow中的亮点功能不容错过 ......
【LeetCode1】统计参与通信的服务器
# 【题目】 - 这里有一幅服务器分布图,服务器的位置标识在 `m * n` 的整数矩阵网格 `grid` 中,1 表示单元格上有服务器,0 表示没有。 - 如果两台服务器位于同一行或者同一列,我们就认为它们之间可以进行通信。 - 请你统计并返回能够与至少一台其他服务器进行通信的服务器的数量。 # ......
[LeetCode][152]maximum-product-subarray
# Content Given an integer array nums, find a subarray that has the largest product, and return the product. The test cases are generated so that the ......
ModuleNotFoundError: No module named 'qrcode'
W File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 222, in _prepare dist = self._prepare_distribution() F ......
[LeetCode][139]word-break
# Content Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dict ......