leetcode anagrams string find

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

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

redis-string常用命令

string类型的常用命令 常用SET/GET SET k1 v1 EX参数:以秒为单位设置过期时间 set k2 v2 EX 10 PX参数:以毫秒为单位设置过期时间 set k2 v2 PX 10000 EXAT参数:设置以秒为单位的UNIX时间戳所对应的时间为过期时间 PXAT参数:设置以毫秒 ......
redis-string 命令 常用 string redis

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

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

B. Reverse Binary Strings

You are given a string $s$ of even length $n$. String $s$ is binary, in other words, consists only of 0's and 1's. String $s$ has exactly $\frac{n}{2} ......
Reverse Strings Binary

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

Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)

001、问题 cmake 报错 [root@PC1 build]# cmake .. 002、解决方法, 下载zlib并安装 官网:http://www.zlib.net/ a、下载 b、解压并安装 [root@PC1 software]# tar -xzvf zlib-1.2.13.tar.gz ......

string类型可以作为lock的锁对象吗

## lock 关键字介绍 lock 关键字是用于在多线程编程中实现同步和互斥访问的关键字。它的作用是确保共享资源在任意时刻只能被一个线程访问,从而避免出现竞态条件(race condition)和数据不一致的问题。 当多个线程同时访问共享资源时,如果没有合适的同步机制,可能会导致数据损坏、结果的不 ......
对象 类型 string lock

做leetcode算法题的一些感受

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

-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system vari

系统是centos7.6 001、问题 -- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system vari 002、解决方法 [root@PC1 cmake-3.27.0-rc3]# yum ......
OpenSSL the folder system Could

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

MYSQL中find_in_set函数用法详解

> 感谢参考:https://blog.csdn.net/carefree31441/article/details/119563685 # 1、官方涵义(MySQL手册中语法说明) FIND_IN_SET(str,strlist) : str 要查询的[字符串](https://so.csdn.n ......
find_in_set 函数 MYSQL find set

PostgreSQL合并多行数据为一行,string_agg函数

通过id列来聚合belong_user_saved列,应用string_agg函数,只要id一样则把第二列通过逗号连接起来 聚合前: ![img](https://img2023.cnblogs.com/blog/2446184/202306/2446184-20230622202013405-11 ......
PostgreSQL string_agg 函数 一行 数据

LeetCode--矩形走位

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

PostgreSql的聚合函数--string_agg

## [聚合函数](https://so.csdn.net/so/search?q=聚合函数&spm=1001.2101.3001.7020) 顾名思义,聚合函数就是类似于min(),max(),sum()等函数,当然这些都是SQL标准的函数,应该都是比较熟悉,也比较常见。这边不对这些常见的函数进行 ......
PostgreSql string_agg 函数 string agg

VSCODE cannot find package "GOPROJECT/src/chapter1/model" in any of解决方法

环境: win10 go 1.20 问题描述: 在go项目中想要导入自己的其他包的方法或变量,保存后提示 cannot find package "GOPROJECT/src/chapter1/model" in any of: D:\VScode\language\Go\src\GOPROJECT ......
quot GOPROJECT chapter1 chapter package

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

pwsh string cmd

compose multiple variables into a command line, then execute it. ```ps1 $dest="a:\des" $source="b:\src" $cmdlink="cmd" $cmdPart1="/c", "mklink", "/j" ......
string pwsh cmd

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

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

将Double类型转换为String类型

在Java中将String转换为Double 使用Double.toString()方法: double num = 3.14159; String str = Double.toString(num); 使用String.valueOf()方法: double num = 3.14159; Str ......
类型 Double String

将Double类型转换为String类型

在Java中将String转换为Double 使用Double.toString()方法: double num = 3.14159; String str = Double.toString(num); 使用String.valueOf()方法: double num = 3.14159; Str ......
类型 Double String

[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

[Leetcode] 0009. 回文数

# [9. 回文数](https://leetcode.cn/problems/palindrome-number) 点击上方,跳转至Leetcode ## 题目描述 给你一个整数 x ,如果 x 是一个回文整数,返回 true ;否则,返回 false 。 回文数是指正序(从左向右)和倒序(从右向 ......
回文 Leetcode 0009

[Leetcode] 0013. 罗马数字转整数

# [13. 罗马数字转整数](https://leetcode.cn/problems/roman-to-integer) 点击上方,跳转至leetcode ## 题目描述 罗马数字包含以下七种字符: I, V, X, L,C,D 和 M。 字符 数值 I 1 V 5 X 10 L 50 C 10 ......
整数 Leetcode 数字 0013

[Leetcode] 0728. 自除数

# [728. 自除数](https://leetcode.cn/problems/self-dividing-numbers) 点击上方,跳转至leetcode ## 题目描述 自除数 是指可以被它包含的每一位数整除的数。 例如,128 是一个 自除数 ,因为 128 % 1 == 0,128 % ......
除数 Leetcode 0728

[Leetcode] 0733. 图像渲染

# [733. 图像渲染](https://leetcode.cn/problems/flood-fill) 点击上方,跳转至leetcode ## 题目描述 有一幅以 m x n 的二维整数数组表示的图画 image ,其中 image[i][j] 表示该图画的像素值大小。 你也被给予三个整数 s ......
Leetcode 图像 0733

[Leetcode] 0724. 寻找数组的中心下标

# [724. 寻找数组的中心下标](https://leetcode.cn/problems/find-pivot-index) 点击上方,跳转至leetcode ## 题目描述 给你一个整数数组 nums ,请计算数组的 中心下标 。 数组 中心下标 是数组的一个下标,其左侧所有元素相加的和等于 ......
下标 数组 Leetcode 0724