字符串 字符 单词leetcode

python_字符串数字求和

有两个字符串类型的数字,实现一个方法将它们进行相加,并返回相加后的数值。(要考虑数据的长度问题) def add_string(num1, num2): num1_int = float(num1) num2_int = float(num2) sum_int = num1_int + num2_i ......
字符串 字符 数字 python

js数字转字符串后科学计数问题

前言:遇到科学计数法转字符串的问题。用如下toNonExponential可解决 function toNonExponential(num) { var m = num.toExponential().match(/\d(?:\.(\d*))?e([+-]\d+)/); return num.to ......
字符串 字符 数字 科学 问题

如何使用 Shell 命令在 linux 当中统计很多文件当中所有的中文字符

grep -P '[\p{Han}]+' **/*.md -oh | tr -d '\s' > cat.log -P 是正则表达式匹配 -h, --no-filename Suppress the prefixing of file names on output. This is the defa ......
字符 命令 文件 Shell linux

english word 单词

一、 学习用品 (school things) bag包;book书; post card明信片;Chinese book语文书;crayon蜡笔;comic book漫画书; dictionary词典; English book英语书; eraser橡皮; Ink墨水, 油墨; math book ......
单词 english word

english英语单词

经济 economy 依靠农民 海关custom 卡死他们 地主landlord 懒得劳动 雄心 ambition 俺必胜 强壮 strong 死壮 羡慕 admire 额的妈呀 脾气 temper 太泼 怀孕pregnant 扑来个男的 救护车 ambulance 俺不能死 律师 lawyer 捞 ......
单词 english

IDEA字符缺失

问题描述 IDEA字符展示缺失,其实是有内容的 版本号: IDEA 2018.1.5 解决过程 调整字体和字体大小 没有效果,可以看到下面的示例里面字体也都是展示齐全的 发现在代码块里面的字符展示是正常的,但注释里面显示不正常,打开注释字体配置 根据缺失的字符,调整对应的注释的颜色、字体加粗或斜体, ......
缺失 字符 IDEA

1_C#字符串常见输出

C#字符串输出 namespace Hello { internal class Program { static void Main(string[] args) { Console.WriteLine("Hello, World!"); string name = "Hello, World!" ......
字符串 字符 常见

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) (^)匹配输入字符串的开始位置和($)匹配输入字符串的结束位置 直接使用 ......
正则 表达式 字符 情况
共12000篇  :6/400页 首页上一页6下一页尾页