leetcode anagrams string find
stoi(),atoi() ,to_string
stoi(),atoi() ,to_string 这三个函数都是对字符串处理的函数,前两者是将字符串转化为十进制 int 类型,最后一个是将十进制类型 int、double 等转化为string头文件都是:#include<cstring> stoi() 和 atoi()这两个功能虽然都是将字符串转 ......
[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],[ ......
[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 ......
java Object转String的4种实现方式
1.情景展示 在实际开发过程中,经常会遇到将Object类型强转成String类型。 Object转String一共有几种实现方式? 2.具体分析 共有三种实现方式。 3.解决方案 以Map<String, Object>进行举例说明。 Map<String, Object> map = new H ......
[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 ......
【LeetCode动态规划#15】最长公共子序列II
### 最长公共子序列(二) #### 描述 给定两个字符串str1和str2,输出两个字符串的最长公共子序列。如果最长公共子序列为空,则返回"-1"。目前给出的数据,仅仅会存在一个最长的公共子序列 数据范围:0≤∣���1∣,∣���2∣≤20000≤∣*s**t**r*1∣,∣*s**t**r* ......
【LeetCode1】统计参与通信的服务器
# 【题目】 - 这里有一幅服务器分布图,服务器的位置标识在 `m * n` 的整数矩阵网格 `grid` 中,1 表示单元格上有服务器,0 表示没有。 - 如果两台服务器位于同一行或者同一列,我们就认为它们之间可以进行通信。 - 请你统计并返回能够与至少一台其他服务器进行通信的服务器的数量。 # ......
vue3.0运行npm run dev 报错Cannot find module ‘node:url‘
### 一、问题描述: - 学习vue3.0( Vue.js - 渐进式 JavaScript 框架 | Vue.js)的时候一直使用的家里电脑,项目搭建运行一直没问题,公司近期用vue3.0写项目 - npm init vue@latest —> npm install 都ok,npm run d ......
java开发中常见的String对象
String对象加载场内存方式有两种,一种是直接使用“”号创建的加载内存时会会把该字符串直接加载到字符常量中去,并且后文中出现相同使用“”号定义的常量时不会再在内存中创建直接使用第一次创建的字符串,另一种直接使用构造器创建的会创建出一个新的字符串,String常见构造器有String(byte[]) ......
[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 ......
[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 ......
Leetcode——1957、删除字符使字符串变好
一个字符串如果没有 三个连续 相同字符,那么它就是一个 好字符串 。 给你一个字符串 s ,请你从 s 删除 最少 的字符,使它变成一个 好字符串 。 请你返回删除后的字符串。题目数据保证答案总是 唯一的 。 示例 1: 输入:s = "leeetcode" 输出:"leetcode" 解释: 从第 ......
[LeetCode][124]binary-tree-maximum-path-sum
# Content A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can onl ......
Leetcode 1. 两数之和(Two sum)
[题目链接🔗](https://leetcode.cn/problems/two-sum) 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素 ......
find常用命令
# 找出目录下大于30M的文件find * -type f -size +30M -print0 | xargs -0 du -sh # 批量删除日志文件find * -type f -size +30M -print0 | xargs -0 du -sh | grep '/diff/root/lo ......
[LeetCode] 1267. Count Servers that Communicate
You are given a map of a server center, represented as a m * n integer matrix grid, where 1 means that on that cell there is a server and 0 means that ......
Leetcode 1782. 统计点对的数目
这两天实训比较忙,之后补 TRANSLATE with x English Arabic Hebrew Polish Bulgarian Hindi Portuguese Catalan Hmong Daw Romanian Chinese Simplified Hungarian Russian ......
error: undefined reference to `cv::imread(cv::String const&, int)' 解决方法
方法1 原文链接:https://blog.csdn.net/WhiteLiu/article/details/72901520 编译时出现下列错误: undefined reference to 'cv::imread(cv::String const&, int)' undefined refe ......
mybatis 报错:Cause: java.lang.NumberFormatException: For input string: "java"
**1、所错图示:** ![](https://img2023.cnblogs.com/blog/3259201/202308/3259201-20230823222133941-21327009.png) **2、为什么包这样的错误?** 在if查询条件的逻辑没有错,其实在代码转换解析时,自动转换 ......
leetcode 12
![image](https://img2023.cnblogs.com/blog/3254178/202308/3254178-20230823182631200-1538353557.png) ### 算法介绍: - **哈希** - **贪心** - 实现代码如下 ```cpp class S ......
org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan(Lorg/apache/tomcat/Jar;Ljava/lang/String;Z)V 解决
原因 <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-jdbc</artifactId> <version>3.1.3</version> </dependency> 解决 <dependency> <groupId> ......
List<Dictionary<string, string>> 去重方法
List<Dictionary<string, string>>可以使用LINQ的Distinct()方法来去重。 不过需要提供一个自定义的Comparer。实现接口IEqualityComparer public class DictionaryComparer : IEqualityCompar ......
gorm的First、Find、Raw与Scan
使用First,Take,Last 进行单条查找,First根据主键正序,Last 根据主键倒序 Find查询结果是列表,First查询的是单条数据。 Raw 中文:原生的 作用:在写gorm语句时候用来写Raw sql语句(原生sql语句) 在使用Raw自定义SQL查询时,使用Scan来接收数据, ......
Leetcode605——种花问题
假设有一个很长的花坛,一部分地块种植了花,另一部分却没有。可是,花不能种植在相邻的地块上,它们会争夺水源,两者都会死去。 给你一个整数数组 flowerbed 表示花坛,由若干 0 和 1 组成,其中 0 表示没种植花,1 表示种植了花。另有一个数 n ,能否在不打破种植规则的情况下种入 n 朵花? ......
Leetcode 202. 快乐数(Happy number)
[题目链接🔗](https://leetcode.cn/problems/happy-number) 编写一个算法来判断一个数 n 是不是快乐数。 「快乐数」 定义为: 对于一个正整数,每一次将该数替换为它每个位置上的数字的平方和。 然后重复这个过程直到这个数变为 1,也可能是 无限循环 但始终变 ......
[LeetCode][121]best-time-to-buy-and-sell-stock
# Content You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a s ......
[LeetCode][96]unique-binary-search-trees
# Content Given an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of unique values from 1 t ......