字符串 字母 字符leetcode

ubuntu编译字符设备

前言 创建一个简单的字符设备驱动程序。 ​ 本文命令的运行基本上都需要root权限,使用root账号,或者在命令前面加上sudo。 ​ 如果你使用ssh远程连接的服务器进行代码编写。那么不要在root用户下创建文件或者文件夹。这会导致你ssh连接vscode编写代码的权限问题。可以在普通用户创建好所 ......
字符 ubuntu 设备

Windows判断一个字符串是否纯十六进制数

#include <regex> using namespace std; bool IsHexDigit(const TCHAR* s) { TCHAR* pattern = _T("^0[xX][0-9A-Fa-f]+$|^[0-9A-Fa-f]+$"); #ifdef UNICODE std: ......
十六进制 字符串 字符 Windows

C# 输出的格式转换,占位/补位,字符串拼接、字符串内插法

// “0”描述:占位符,如果可能,填充位 Console.WriteLine(string.Format("{0:000000}", 1234)); // 结果:001234 // “#”描述:占位符,如果可能,填充位 Console.WriteLine(string.Format("{0:### ......
字符串 内插法 字符 格式

字符串字面量初始化数组的歧义?

char arr[]={'h','e','l','l','o','\0'} 声明初始化一个字符数组。 为了方便书写,我们也可以写成语法糖形式 char arr={"hello"} 或者 char []arr="hello" "hello"是一个char []数组类型,C语言规定:数组类型对象用作表达 ......
歧义 字面 数组 字符串 字符

[LeetCode] 1578. Minimum Time to Make Rope Colorful

Alice has n balloons arranged on a rope. You are given a 0-indexed string colors where colors[i] is the color of the ith balloon. Alice wants the rope ......
LeetCode Colorful Minimum 1578 Make

十进制整数转十六进制字符串

描述 编写一个函数,传入一个十进制的正整数,将十进制整数转换为十六进制的字符串并返回。(十六进制字符串中的字母全部大写) 输入描述: 键盘输入一个十进制的正整数 输出描述: 输出该十进制整数转换后的十六进制字符串 示例1 输入:162 输出:A2 示例2 输入:50 输出:32 示例3 输入:501 ......

[LeetCode Hot 100] LeetCode111. 二叉树的最小深度

题目描述 思路 二叉树的最小深度就是第一个叶子节点所在的层数 方法一:前序遍历(递归、dfs) /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeN ......
LeetCode 深度 Hot 100 111

[LeetCode Hot 100] LeetCode110. 平衡二叉树

题目描述 思路 LeetCode104. 二叉树的最大深度 变种 方法一:后序遍历(递归、dfs) /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * Tre ......
LeetCode Hot 100 110

[LeetCode Hot 100] LeetCode543. 二叉树的直径

题目描述 思路 所谓二叉树的直径,就是左右子树的最大深度之和。 方法一: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; ......
LeetCode 直径 Hot 100 543

[LeetCode Hot 100] LeetCode104. 二叉树的最大深度

题目描述 思路 熟练掌握二叉树的遍历算法 方法一:层序遍历(迭代)+计数 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; ......
LeetCode 深度 Hot 100 104

[LeetCode Hot 100] LeetCode102. 二叉树的层序遍历

题目描述 思路 方法一:递归 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * Tree ......
LeetCode Hot 100 102

[LeetCode Hot 100] LeetCode144. 二叉树的前序遍历

题目描述 思路 熟练掌握迭代和递归的代码。 递归代码:额外写一个函数void preOrder(TreeNode node, List res) 迭代代码:会用到数据结构——栈。先入栈当前节点的右子节点,再入栈左子节点。 方法一:递归 /** * Definition for a binary tr ......
LeetCode Hot 100 144

[LeetCode Hot 100] LeetCode94. 二叉树的中序遍历

题目描述 思路 熟练掌握迭代和递归的代码。 递归:额外写一个函数void inOrder(TreeNode node, List res) 迭代:令cur = root,一直往左子树找,找到最后一个左子节点,当cur为空,就开始处理栈顶元素(将栈顶元素加入结果集),随后将cur设置为右子节点,继续执 ......
LeetCode Hot 100 94

[LeetCode Hot 100] LeetCode145. 二叉树的后序遍历

题目描述 思路 递归:额外写一个函数void postOrder(TreeNode node, List res) 迭代: 前序遍历:根 左 右 将前序遍历改造成:根 右 左 然后反转根右左为:左 右 根,即为后序遍历 优化一下: while (!stack.isEmpty()) { TreeNod ......
LeetCode Hot 100 145

Leetcode每日一题

目录202312/2512/2612/27 2023 12月往前的应该就不会补题解了,大概有时间会往前一直补到12/1的题解 12/25 1276. 不浪费原料的汉堡制作方案 题目分析: 数学题,解二元一次方程即可 具体过程有$$\left { \begin{array}{c}4x+2y=tomat ......
Leetcode

字符串中string str=null和string str=""和string str=string.Empty的区别

string.Empty相当于“”,Empty是一个静态只读的字段。 string str="" ,初始化对象,并分配一个空字符串的内存空间 string str=null,初始化对象,不会分配内存空间 ......
string str quot 字符串 字符

C# 从两个字符串中找出最大公共子串

string strA = "ahjeibnkwed"; string strB = "oiopqdibnwaaldo"; int iMax = 0;//公共子串的最大长度 int iEnd = 0;//公共子串的起始位置 int iA = strA.Length; int iB = strB.Le ......
字符串 字符 两个

安全的字符串拼接

假如你需要拼接一些不确定类型的变量为字符串,你需要确保算术运算符在你拼接时不会起作用。使用concat: var one = 1; var two = 2; var three = '3'; var result = ''.concat(one, two, three); //"123" 这应该就是 ......
字符串 字符

【动态规划】leetcode 不同路径问题

题目名称:63. 不同路径 II 链接:https://leetcode.cn/problems/unique-paths-ii/description/ 题目内容: 一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为 “Start” )。 机器人每次只能向下或者向右移动一步。机器 ......
路径 leetcode 动态 问题

JS获取URL字符串中的参数

// 获取完整的URL字符串 var url = window.location.href; // 获取URL字符串中的参数部分 var params = url.split('?')[1]; // 将参数部分按照&符号分割成数组 var paramsArray = params.split('&' ......
字符串 字符 参数 URL

js字符串,取得文件扩展名

解决方法 1: 正则表达式 function getFileExtension1(filename) { return (/[.]/.exec(filename)) ? /[^.]+$/.exec(filename)[0] : undefined; } 解决方法 2: String的split方法 ......
扩展名 字符串 字符 文件

[LeetCode] 2660. Determine the Winner of a Bowling Game

You are given two 0-indexed integer arrays player1 and player2, that represent the number of pins that player 1 and player 2 hit in a bowling game, re ......
Determine LeetCode Bowling Winner 2660

正则表达式校验特殊字符(通用,一般情况下)

/[\`\~\!\@\#\$\%\^\&\*\(\)\_\+\-\=\{\}\|\[\]\:\;\'\<\>\?\,\.]*/.test(string)//直接写判断条件时,不使用 /^ XXX $/.test(string) (^)匹配输入字符串的开始位置和($)匹配输入字符串的结束位置 直接使用 ......
正则 表达式 字符 情况

NDK-以十六进制字符串的形式打印char[]数组到logcat

NDK-以十六进制字符串的形式打印char[]数组到logcat 1. 在Java中打印 public static String convertByteArr2String(byte[] bArr) { StringBuilder builder = new StringBuilder(); fo ......
十六进制 数组 字符串 字符 形式

git 提交后中文字符会乱码

转载自:https://blog.csdn.net/yilongchuan/article/details/92833077 最近发生那了一件怪事,当然菜鸡经常碰见怪事 本来一个.properties文件在idea里面commit的时候看了一下diff,没发现异常,但是提交到gitlab上发现.pr ......
乱码 字符 git

提取字符串中的中文和数字

/** * @Author :tc * @Date :Created in 4:06 PM 2023/12/26 */ public class RegularUtil { public static final String regex = "[\\u4e00-\\u9fa50-9]"; /** ......
字符串 字符 数字

leetcode 1633. 各赛事的用户注册率

https://leetcode.cn/problems/percentage-of-users-attended-a-contest/?envType=study-plan-v2&envId=sql-free-50 聚合函数分组后计算的是一组内的数据, 分组前我们认为所有数据是一组 本题注意还需要 ......
赛事 leetcode 用户注册 用户 1633

C# 返回字符串 string 中某一个字符第几次出现的位置所在的索引位置

// 返回 str 从前往后,第 count 次出现 ch 字符处的索引位置,失败返回 -1; protected static int IndexOf(string str, char ch, int count) { if (count < 1) { return -1; } int index ......
字符 位置 字符串 索引 所在

【LeetCode】131. 分割回文串

题目 给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是 回文串 。返回 s 所有可能的分割方案。 回文串 是正着读和反着读都一样的字符串。 示例 1: 输入:s = "aab" 输出:[["a","a","b"],["aa","b"]] 示例 2: 输入:s = "a" 输出:[["a ......
回文 LeetCode 131

【LeetCode】17. 电话号码的字母组合

链接: https://leetcode.cn/problems/letter-combinations-of-a-phone-number/ 思路: 利用深度优先遍历 遍历两个空间 第一个空间是digits,命名为space1 第二个空间是digits的每一位自身的空间,命名为space2 关键是 ......
电话号码 字母 LeetCode 号码 电话
共12000篇  :6/400页 首页上一页6下一页尾页