operations leetcode minimum halve

有效的括号--LeetCode算法

不用map的解法 public boolean isValid(String s) { //输入的字符串为空,直接返回true if(s.isEmpty()) return true; //新建一个栈 Stack<Character> stack=new Stack<Character>(); // ......
括号 算法 LeetCode

ERROR: Attempting to operate on hdfs namenode as root问题的解决

# 问题描述 在我尝试启动hadoop集群的时候,突然出现这个问题,一串的ERROR啊,真的是很搞心态! ![](https://img2023.cnblogs.com/blog/2808014/202308/2808014-20230809220143092-982803489.png) # 问题 ......
Attempting namenode operate 问题 ERROR

Leetcode 704. 二分查找(Binary Search)

[题目链接](https://leetcode.cn/problems/binary-search) 给定一个n个元素有序的(升序)整型数组`nums`和一个目标值`target`, 写一个函数搜索`nums`中的`target`, 如果目标值存在返回下标, 否则返回`-1`。 示例 1: ``` ......
Leetcode Binary Search 704

LeetCode从算法到算命—1749.任意子数组和的绝对值的最大值

# 1749.任意子数组和的绝对值的最大值 ## 题目信息 给你一个整数数组 `nums` 。一个子数组 `[numsl, numsl+1, ..., numsr-1, numsr]` 的 **和的绝对值** 为 `abs(numsl + numsl+1 + ... + numsr-1 + nums ......
绝对值 最大值 数组 算法 LeetCode

使用golang解决LeetCode热题Hot100(1-10)

# 使用golang解决LeetCode热题Hot100 ## 1.两数之和 ### https://leetcode.cn/problems/two-sum/ #### 题目 给定一个整数数组 `nums` 和一个整数目标值 `target`,请你在该数组中找出 **和为目标值** *`targe ......
LeetCode golang Hot 100 10

Leetcode刷题记录本

# Leetcode刷题记录本 ### ID: 1 点击查看代码 1. 暴力破解法 ```python class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: in ......
Leetcode

leetcode:下一个排列

class Solution { public: void nextPermutation(vector<int>& nums) { int n=nums.size(); int i=n-2; while(i>=0 && nums[i]>=nums[i+1]){//从后向前,找到第一个降序的,一直升 ......
leetcode

swagger显示示No operations defined in spec的解决

背景: Spring2.6集成swagger2.0, 启动后访问:http://localhost:80/swagger-ui/index.html,报错: No operations defined in spec! 查询资料的好几种结果: 1. swagger解析的包路径配置错误, 需要修改ba ......
operations swagger defined spec in

Paper Reading: Multitree Genetic Programming With New Operators for Transfer Learning in Symbolic Regression With Incomplete Data

针对数据集存在缺失值的问题,本文提出了一种基于多树 GP(MTGP) 的迁移学习方法 pMTGPDA,用于将知识从完整的源域转移到不完整的目标域中。首先在源域的数据集上训练多个 SR 模型,通过模型中的训练细节计算源域的特征和实例的权重作为先验知识。然后将提取的权重知识用于基于 MTGP 的转换,构... ......

LeetCode -- 127. 单词接龙

方法一:双向广搜 class Solution { public: int ladderLength(string beginWord, string endWord, vector<string>& wordList) { set<string> se; for(auto it : wordLis ......
接龙 单词 LeetCode 127

LeetCode 热题 100 之 240. 搜索二维矩阵 II

# 题目 编写一个高效的算法来搜索 m x n 矩阵 matrix 中的一个目标值 target 。该矩阵具有以下特性: 每行的元素从左到右升序排列。 每列的元素从上到下升序排列。 **示例一** ![image](https://img2023.cnblogs.com/blog/2204134/2 ......
矩阵 LeetCode 100 240 II

LeetCode 16. 3Sum Closest 双指针+排序

Given an integer array `nums` of length n and an integer `target`, find three integers in nums such that the sum is closest to `target`. Return the su ......
指针 LeetCode Closest 3Sum Sum

LeetCode从算法到算命—344.翻转字符串

# 344.翻转字符串 ## 题目信息 编写一个函数,其作用是将输入的字符串反转过来。输入字符串以字符数组 `s` 的形式给出。 不要给另外的数组分配额外的空间,你必须**[原地](https://baike.baidu.com/item/原地算法)修改输入数组**、使用 O(1) 的额外空间解决这 ......
字符串 算法 字符 LeetCode 344

C++入门到放弃(10)——操作符重载:operator

​1.重载 重载允许创建多个名称相同,但输入不同的函数,这些函数的参数列表不同,可以通过给予不同输入变量调用对应的函数。 函数重载的关键是函数的参数列表。如果两个函数的参数数量和类型相同,同时参数的排列顺序也相同,那么就是同一个函数,不构成重载,它与f返回值和变量名都无关。 void print(c ......
操作符 operator 10

LeetCode 周赛上分之旅 #38 结合排序不等式的动态规划

> ⭐️ **本文已收录到 AndroidFamily,技术和职场问题,请关注公众号 \[彭旭锐] 和 [BaguTree Pro](https://www.mdnice.com/writing/85b28c4e60354865a423728e668fc570) 知识星球提问。** > > 学习数据 ......
不等式 LeetCode 之旅 动态 38

LeetCode 周赛上分之旅 # 37 多源 BFS 与连通性问题

> ⭐️ **本文已收录到 AndroidFamily,技术和职场问题,请关注公众号 \[彭旭锐] 和 [BaguTree Pro](https://files.mdnice.com/user/3257/de950859-eb71-4821-a36b-bebe5cff500d.png) 知识星球提问 ......
LeetCode 之旅 问题 BFS 37

LeetCode从算法到算命—24.两两交换链表中的节点(0806)

# 24.两两交换链表中的节点 ## 题目信息 给你一个链表,两两交换其中相邻的节点,并返回交换后链表的头节点。你必须在不修改节点内部的值的情况下完成本题(即,只能进行节点交换)。 **示例 1:** ![image](https://img2023.cnblogs.com/blog/3083774 ......
节点 算法 LeetCode 0806 24

leetcode:括号生成

回溯的本质是穷举,穷举所有情况,这里有剪枝,只在有效情况下继续 class Solution { vector<string> res; string str; void backtracking(int left,int right){ if(left<0 || left>right) retur ......
括号 leetcode

Leetcode第357场周赛

https://leetcode.cn/contest/weekly-contest-357/ ## C 寻找不安全路径 以所有小偷点为源点,跑多源点BFS,求出每个点到最近小偷点的曼哈顿距离,记为w[i, j] 二分答案Mid,只允许走w[i, j] >= mid的点,从源店跑DFS/BFS,看是 ......
Leetcode 357

【LeetCode剑指offer#06】实现pow函数、计算x的平方根

### 实现pow函数 实现 [pow(*x*, *n*)](https://www.cplusplus.com/reference/valarray/pow/) ,即计算 `x` 的整数 `n` 次幂函数(即,`xn` )。 **示例 1:** ``` 输入:x = 2.00000, n = 10 ......
平方根 函数 LeetCode offer pow

[LeetCode] 1351. Count Negative Numbers in a Sorted Matrix 统计有序矩阵中的负数

Given a `m x n` matrix `grid` which is sorted in non-increasing order both row-wise and column-wise, return *the number of **negative** numbers in* `g ......
负数 矩阵 LeetCode Negative Numbers

LeetCode从算法到算命—每日一题(0805)

# 21. 合并两个有序链表 ## 题目信息 将两个升序链表合并为一个新的 **升序** 链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。 **示例 1:** ``` 输入:l1 = [1,2,4], l2 = [1,3,4] 输出:[1,1,2,3,4,4] ``` **示例 2:** ......
算法 LeetCode 0805

LeetCode 206 反转链表,LeetCode 92反转链表Ⅱ

206. 反转链表 给你单链表的头节点 head ,请你反转链表,并返回反转后的链表。 示例 1: 输入:head = [1,2,3,4,5] 输出:[5,4,3,2,1] 示例 2: 输入:head = [1,2] 输出:[2,1] 示例 3: 输入:head = [] 输出:[] 提示: 链表中 ......
LeetCode 206

LeetCode -- 722. 删除注释

利用双指针来进行删除操作 class Solution { public: vector<string> removeComments(vector<string>& source) { string str; for(auto it : source) str += it + "'"; int n ......
注释 LeetCode 722

LeetCode 3. 无重复字符的最长子串

``` class Solution { public: int res=0; int lengthOfLongestSubstring(string s) { int n=s.size (); if(!n) return 0; bool st[128]={false}; for(int j=0,i ......
字符 LeetCode

LeetCode从算法到算命—每日一题(0804)

# 980.不同路径III ## 题目信息 在二维网格 `grid` 上,有 4 种类型的方格: - `1` 表示起始方格。且只有一个起始方格。 - `2` 表示结束方格,且只有一个结束方格。 - `0` 表示我们可以走过的空方格。 - `-1` 表示我们无法跨越的障碍。 返回在四个方向(上、下、左 ......
算法 LeetCode 0804

LeetCode 739. 每日温度

``` class Solution { public: vector dailyTemperatures(vector& t) { stack st; int n=t.size(); vector res(n); for(int i=n-1;i>=0;i--) { while(st.size()& ......
LeetCode 温度 739

LeetCode -- 980. 不同路径 III

本题让我们求不相交路径数目 方法1:递归/回溯 dfs(x, y, left) 表示从点x, y出发,还剩下left个可行走点的路径数目。 每行走到一个新的点就将该点设置为-1, 避免重复搜索。 当走到终点时,如果left == 0 则答案 + 1 class Solution { int dfs( ......
路径 LeetCode 980 III

[LeetCode] 980. Unique Paths III

You are given an m x n integer array grid where grid[i][j] could be: 1 representing the starting square. There is exactly one starting square. 2 repre ......
LeetCode Unique Paths 980 III