字符串 字符leetcode reverse

字符串占位符替换

想模版引擎一样,替换字符串中的 ${} 占位符。 那为什么不直接使用模版引擎呢?…… public class A{ private static final String BRACE_LEFT = "{"; private static final String BRACE_RIGHT = "}" ......
字符串 字符

在List<String>中找出重复的字符串元素__简单高效

点击查看代码 ``` public void assertNoDuplicateStr(List list, String key) { if (ObjectUtils.isEmpty(list)) { return; } Set set = new HashSet(); list.stream() ......
字符串 字符 元素 String List

[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 grid. Exampl ......
LeetCode Negative Numbers Matrix Sorted

递归-二叉搜索树-leetcode98验证二叉搜索树

```java //leetcode submit region begin(Prohibit modification and deletion) /** * Definition for a binary tree node. * public class TreeNode { * int va ......
leetcode 98

找到所有好字符串

给你两个长度为 n 的字符串 s1 和 s2 ,以及一个字符串 evil 。请你返回 好字符串 的数目。 好字符串 的定义为:它的长度为 n ,字典序大于等于 s1 ,字典序小于等于 s2 ,且不包含 evil 为子字符串 ###一. 数位dp + KMP算法 ``` const int MOD = ......
字符串 字符

LeetCode35.搜索插入位置

//个人学习笔记用 - 题目: 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。 请必须使用时间复杂度为 O(log n) 的算法。 参考题解--代码随想录 - 暴力解法: ~~~c++ class Solution { pub ......
LeetCode 位置 35

python 中统计指定字符串出现的次数

001、 >>> str1 = "abcdaaab" ## 测试字符串 >>> str1.count("a") ## 统计a出现的次数 4 >>> str1.count("b") 2 >>> str1.count("c") 1 >>> str1.count("a", 0, 4) ## 可以指定统计字 ......
中统 字符串 字符 次数 python

python 中字符串大小写的转换

001、全部转换为大写、或者全部转换为小写 >>> str1 = "abcDEFgh" >>> str1.lower() ### 小写 'abcdefgh' >>> str1.upper() ## 大写 'ABCDEFGH' >>> str1 'abcDEFgh' >>> str1.casefold ......
字符串 字符 大小 python

LeetCode 90. 子集 II

``` class Solution { public: unordered_map cnt; vector> res; vector path; vector> subsetsWithDup(vector& nums) { for(auto i:nums) cnt[i]++; dfs(-10);/ ......
子集 LeetCode 90 II

【leetcode】104. Maximum Depth of Binary Tree

给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 **说明:** 叶子节点是指没有子节点的节点。 **示例:** 给定二叉树 `[3,9,20,null,null,15,7]`, ``` 3 / \ 9 20 / \ 15 7 ``` 返回它的最大深度 3 ......
leetcode Maximum Binary Depth Tree

LeetCode 40. 组合总和 II

``` class Solution { public: vector> res; vector> combinationSum2(vector& candidates, int target) { sort(candidates.begin(),candidates.end()); dfs(can ......
总和 LeetCode 40 II

LeetCode 39. 组合总和

``` class Solution { public: vector> res; vector> combinationSum(vector& candidates, int target) { dfs(candidates,0,target); return res; } vector path ......
总和 LeetCode 39

【leetcode】21. Merge Two Sorted Lists

将两个升序链表合并为一个新的 **升序** 链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。 **示例 1:** ![](https://assets.leetcode.com/uploads/2020/10/03/merge_ex1.jpg) **输入:**l1 = \[1,2,4\] ......
leetcode Sorted Merge Lists Two

后端获取TOKEN返oss上传地址,前端如何将字符串传给这个地址

您也可以使用 Axios 库来发送请求,以下是发送表单请求的示例代码: const axios = require('axios'); function uploadStringToOSS(ossPostData, content) { const formData = new FormData() ......
地址 前端 字符串 字符 TOKEN

Leetcode 2611. 老鼠和奶酪

### 题目: 有两只老鼠和 `n` 块不同类型的奶酪,每块奶酪都只能被其中一只老鼠吃掉。 下标为 `i` 处的奶酪被吃掉的得分为: - 如果第一只老鼠吃掉,则得分为 `reward1[i]` 。 - 如果第二只老鼠吃掉,则得分为 `reward2[i]` 。 给你一个正整数数组 `reward1` ......
奶酪 Leetcode 老鼠 2611

MySQL-生成随机数字、字符串、日期、验证码及 UUID的方法

一、生成随机数字 1. 生成 0 到 1 之间的随机数 MySQL 中的 RAND 函数可以用于生成一个大于等于 0 小于 1 的随机数字。例如: SELECT rand(); 该函数返回的数据类型为 double,包含 16 位小数;每次调用都会返回不同的数据。 如果想要重现某些场景,需要确保每次 ......
字符串 字符 日期 数字 方法

c#字节数组转16进制字符串

/// <summary> /// 字节数组转16进制字符串-无空格分隔 /// </summary> /// <param name="byteDatas"></param> /// <returns></returns> public static string ToHexStrFromByte ......
进制 数组 字符串 字节 字符

Python在循环中修改遍历的字符串

举例展示 Python在循环中修改遍历的字符串,将不会影响循环的遍历顺序和执行轮数 astr = "abcaef" bstr = "bcef" for i in astr: if i not in bstr: astr = astr.replace(i,'') print(i) 如上示例代码中,当i ......
字符串 字符 Python

浮点数转字符串

浮点数转字符串 using UnityEngine; public class Juse : MonoBehaviour { float a = 2; float b = 6666.6666f; void Start() { Debug.Log(a.ToString("#00"));//输出:02 ......
字符串 点数 字符

各种数据库连接字符串

SqlServer “Data Source=127.0.0.1; Initial Catalog=dbname;User Id=sa;Password=****;” Oracle "Data Source=127.0.0.1/dbname;port=1521;User Id =orcl; Pass ......
字符串 字符 数据库 数据

【acwing】Trie字符串统计

Trie树 学习感受 相比于之前学习的kmp匹配算法,Trie树的实现还是非常好理解的。(kmp算法太难了orz) 从直观的模拟过程来看,trie树就像一颗树一样,从上(根节点)到下(叶节点)有序串联起来组成一个字符串。 每一个额外标记结束的位置表示字符串的结束,通过计算标记数即可指导一共有多少该字 ......
字符串 字符 acwing Trie

C# 获取两个字符串之间是字符方法(备用)

public static string MidStrEx(string sourse, string startstr, string endstr) { string result = string.Empty; int startindex, endindex; try { startinde ......
字符 字符串 之间 两个 方法

前后端地址过滤特殊字符

Java过滤特殊字符 /** * 获取收货地址 过滤特殊字符 * @param address * @return */ public static String getAddr(String address) { if(StringUtils.isNotEmpty(address)) { Stri ......
字符 地址

Linux 字符编码

1、查看字符编码和语言使用 locale 命令,语言是en_US(英语_美式),编码是UTF-8 2、修改字符编码和语言对应配置文件 centos7 修改文件 /etc/locale.conf centos6 修改文件 /etc/sysconfig/i18n 2.1 先看一下修改前的 2.2 然后, ......
字符 编码 Linux

006 数据库学习笔记--字符串操作函数 + 索引

常用字符串操作函数: --返回字符串中指定的子串出现的开始位置(索引从1开始) select CHARINDEX('34','1234567890123') as startIndex --返回字符串中指定的子串出现的开始位置(索引从1开始,字串前必须加%) select PATINDEX('%34 ......
字符串 函数 字符 索引 数据库

7.16 字符串格式化

* format ``` public class HelloWorld { public static void main(String args[]){ String name = "张三"; int age = 19; double score = 8.8; String str = Stri ......
字符串 字符 格式 7.16 16

7.15 字符串的截取

* substring , 经常结合indexOf,lastIndexOf 使用, ``` String str = "www.mldn.cn"; System.out.println(str.substring(4));// 4之后都截取 System.out.println(str.substr ......
字符串 字符 7.15 15

删除字符串中相邻的重复字母

**题目**:去除字符串中相邻且相等的两个字母,得到一个新字符串,并重复进行该操作,知道不能删除为止。 **思路**:这道题首先想到的是利用循环,定义一个空的结果数组,遍历字符串的每一个元素,与结果数组中的最后一个元素比较,如果不相同,则追加该元素,反之删除数组最后一个元素。实现如下: ``` co ......
字符串 字母 字符

7.14 字符串拆分

* split ``` public class HelloWorld { public static void main(String args[]){ String str = "hello world hello mldn"; // split 按照指定字符串全部拆分 // String re ......
字符串 字符 7.14 14

7.12 字符串查找

* contains indexOf, lastIndexOf,startsWith,endWith ``` public class HelloWorld { public static void main(String args[]){// String args[]字符串数组的意思 Strin ......
字符串 字符 7.12 12