字符串 字符 单词leetcode

Mysql字符串截取

字符串截取 SUBSTRING(str,pos) 参数说明 参数名解释 str 需要拆分的字符串 delim 分隔符,通过某字符进行拆分 count 当 count 为正数,取第 n 个分隔符之前的所有字符; 当 count 为负数,取倒数第 n 个分隔符之后的所有字符。 ......
字符串 字符 Mysql

shell 之 使用sed替换文本中某个字符串

#!/bin/bash if [ $# -lt 3 ] then echo "Usage:$0 <old_string> <new_string> <file path>" exit 1 fi old_string=$1 new_string=$2 file_path=$3 if [ -f "$fi ......
字符串 字符 文本 shell sed

代码随想录Day16-Leetcode104. 二叉树的最大深度,111.二叉树的最小深度 ,222.完全二叉树的节点个数

104. 二叉树的最大深度 首先是层序遍历 /** * Definition for a binary tree node. * function TreeNode(val, left, right) { * this.val = (val undefined ? 0 : val) * this.l ......
深度 随想录 节点 随想 个数

when is 二: 判断数字字符、奇偶数、整除、大写、小写,版本号比较

1、数字与字符常用的比较 even : 判断数值是否是偶数,是偶数则返回真; odd :判断数值是否是奇数,是奇数则返回真; divisibleby(num) :判断是否可以整除指定的数值,如果除以指定的值以后余数为0,则返回真; number: 是否为数字; string: 是否为字符; lowe ......
奇偶数 奇偶 小写 大写 字符

LeetCode 287. 寻找重复数

LeetCode 287. 寻找重复数 题目 \287. 寻找重复数 中等 2.1K 相关企业 给定一个包含 n + 1 个整数的数组 nums ,其数字都在 [1, n] 范围内(包括 1 和 n),可知至少存在一个重复的整数。 假设 nums 只有 一个重复的整数 ,返回 这个重复的数 。 你设 ......
LeetCode 287

代码随想录Day15-Leetcode102. 二叉树的层序遍历,226.翻转二叉树,101. 对称二叉树

102. 二叉树的层序遍历 题目链接:https://leetcode.cn/problems/binary-tree-level-order-traversal/ bfs,队列,记录下本层的数量和下一层的数量 /** * Definition for a binary tree node. * f ......
随想录 随想 Leetcode 代码 Day

【DP】LeetCode 剑指 Offer 60. n个骰子的点数

题目链接 剑指 Offer 60. n个骰子的点数 思路 动态规划问题中,只用考虑第 n 个阶段如何由第 n-1 个阶段转化过来 在本题中,就是投掷 n 个骰子的结果如何由 投掷 n-1 个骰子的结果转化过来。 代码 class Solution { public double[] dicesPro ......
骰子 点数 LeetCode Offer 60

js 字符串

1.字符串截取 var num = url.indexOf('#'); //获取#在的位置信息 if (num){ URL = url.substring(0,num); //截取网址信息 ......
字符串 字符 js

华为OD机试 重组字符串

本期题目:重组字符串 题目 给定一个非空字符串 S,其被 N 个‘-’分隔成 N+1 的子串,给定正整数 K, 要求除第一个子串外,其余的子串每 K 个字符组成新的子串,并用‘-’分隔。 对于新组成的每一个子串,如果它含有的小写字母比大写字母多,则将这个子串的所有大写字母转换为小写字母; 反之,如果 ......
字符串 字符

Java中判断字符串相等

Java中判断字符串相等 在Java中,如果我们想要判断两个字符串值是否相等,会不会首先想到用“==”呢?那么用“==”是否可能会出现问题呢? 比如:下面s1和s2是否相等? String s1="abc"; String s2= new String("abc"); 1 public class ......
字符串 字符 Java

三个线程分别打印 A,B,C,要求这三个线程一起运行,打印 n 次,输出形如“ABCABCABC....”的字符串

using System; using System.Threading; class PrintThread { private string text; private int count; private Semaphore semaphore; private Semaphore nextS ......
线程 三个 字符串 ABCABCABC 字符

力扣---面试题 01.09. 字符串轮转

字符串轮转。给定两个字符串s1和s2,请编写代码检查s2是否为s1旋转而成(比如,waterbottle是erbottlewat旋转后的字符串)。 示例1: 输入:s1 = "waterbottle", s2 = "erbottlewat" 输出:True示例2: 输入:s1 = "aa", s2 ......
字符串 字符 01 09

P5337 [TJOI2019]甲苯先生的字符串

同CF222E #include<iostream> #include<algorithm> #include<cstring> #include<vector> #define IOS std::ios::sync_with_stdio(0) using namespace std; const ......
甲苯 字符串 字符 先生 P5337

常用字符串操作函数

前言: Go 语言对字符串的操作主要集中在 strings 包中 https://go-zh.org/pkg/strings/ 正文: 判断字符串是否包含某个字符 func Contains(s, substr string) bool 示例: var str = "hello world !" e ......
字符串 函数 字符 常用

leetcode-1089-easy

Duplicate Zeros Given a fixed-length integer array arr, duplicate each occurrence of zero, shifting the remaining elements to the right. Note that ele ......
leetcode 1089 easy

leetcode-1009-easy

Complement of Base 10 Integer The complement of an integer is the integer you get when you flip all the 0's to 1's and all the 1's to 0's in its binar ......
leetcode 1009 easy

leetcode-1317-easy

Convert Integer to the Sum of Two No-Zero Integers No-Zero integer is a positive integer that does not contain any 0 in its decimal representation. Gi ......
leetcode 1317 easy

实验2 字符串和列表

task1.py x = 'nba FIFA' print(x.upper()) print(x.lower()) print(x.swapcase()) print() x = 'abc' print(x.center(10, '*')) print(x.ljust(10, '*')) print ......
字符串 字符

【LeetCode】35.搜索插入位置

题目描述 解法 思路:二分查找 class Solution { public: int searchInsert(vector<int>& nums, int target) { int left = 0, right = nums.size() - 1; int count = 0; if(nu ......
LeetCode 位置 35

【LeetCode】278.第一个错误的版本

题目描述 解法 思路:二分查找 注意:当第一个 isBadVersion(mid)的结果为true时,得到第一个错误的版本 // The API isBadVersion is defined for you. // bool isBadVersion(int version); class Sol ......
LeetCode 错误 版本 278

【LeetCode】704.二分查找

题目描述 解法 class Solution { public: int search(vector<int>& nums, int target) { int left = 0; int right = nums.size()-1; while(left <= right){ int mid = ......
LeetCode 704

JavaScript系列 -> 截取字符串方法 substring/slice/substr

因为对于截取字符串的方法时常弄混,每次使用的时候,都需要不断的看教程回顾,现在总结到这里: substring substring(start,end): start/end 分别为开始位置和结束位置; 左闭右开,不包含结束位置; start/end 应该为非负整数; start小于0,当成0处理; ......
字符串 JavaScript substring 字符 方法

字符类型+逃逸字符

#include <stdio.h> int main() { // 字符和数字是不同的 char a=1; char b='1'; printf("%d\n",a); //1 printf("%d\n",b); //49 这个49是ASCII码 printf("%c\n",b); //'1' 输出 ......
字符 类型

[oeasy]python0118_语言的发展_希腊字符_拼音文字_亚历山大大帝

希腊字符回忆上次内容 尼罗河流域 的 埃及圣书体 是象形文字 两河流域 的 苏美尔楔形文字 不是象形文字 做生意的 腓尼基人 利用 埃及圣书体 的 字型 苏美尔楔形文字 的 写法 构造出 腓尼基字符 腓尼基字符 是 纯拼音标记 象形符号 发展成为 字母 逐渐失去象形的意义 只是作为 发音的标记 拼音 ......
大帝 拼音 字符 语言 文字

sql根据指定符号拆分字符串表函数

CREATE FUNCTION [dbo].[StrSplit] ( @str NVARCHAR(MAX),--字符串 @split VARCHAR(10),--截取符号 @num INT --返回第几条数据,不填则全部返回 ) RETURNS @Temp TABLE ( List VARCHAR( ......
字符串 函数 符号 字符 sql

leetcode 176

leetcode 176 第二高的薪水,查第二高的人的信息 1、使用ifnull(exp1, exp2)函数,limit offset子句 select ifnull( (select distinct salary from Employee order by salary desc limit ......
leetcode 176

JavaScript系列 -> 字符串方法 replace 的第二个参数为函数

本篇文章要介绍,当字符串的replace方法第二个参数为函数的使用。 示例代码: function fn(str){ this.str = str; } fn.prototype.format = function() { var arg = arguments; return this.str.r ......
字符串 JavaScript 函数 字符 参数

Golang 挑战:编写函数 walk(x interface{}, fn func(string)),参数为结构体 x,并对 x 中的所有字符串字段调用 fn 函数。难度级别:递归。

golang 挑战:编写函数 walk(x interface{}, fn func(string)),参数为结构体 x,并对 x 中的所有字符串字段调用 fn 函数。难度级别:递归。 为此,我们需要使用 反射。 计算中的反射提供了程序检查自身结构体的能力,特别是通过类型,这是元编程的一种形式。这也 ......
函数 字段 字符串 interface 字符

代码随想录Day14-Leetcode144. 二叉树的前序遍历,94.二叉树的中序遍历,145.二叉树的后序遍历

递归遍历 前序遍历:根左右 一路俯冲,然后回头 /** * Definition for a binary tree node. * function TreeNode(val, left, right) { * this.val = (val undefined ? 0 : val) * this ......
随想录 随想 Leetcode 代码 Day

如何使用awk从后向前来截取字符串?

下面有这样的一个变量: NGINX_INFO:="MjQwODo1YTgwOjoy:22:root:WW9ueW91QDIwMjI=" 如何实现,以冒号为分隔符,截取 22(端口)这个字段? 可以从开头,截取第2个字段,如果从后面进行截取呢? 使用下面的方法来实现: 使用NF 来获取最后一个字段,这 ......
字符串 字符 awk