leetcode anagrams string find

力扣——1 [两数之和](https://leetcode.cn/problems/two-sum/)

给定一个整数数组 `nums` 和一个整数目标值 `target`,请你在该数组中找出 **和为目标值** *`target`* 的那 **两个** 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。 你可以按任意顺序返回答案。 **示例 ......
之和 leetcode problems two-sum https

【Leetcode刷题记录】四种买卖股票问题

前言:买卖股票问题大多数都是用动态规划解决,关键在于手上是否有股票,据此来找状态转移方程 1、买卖股票的最佳时机 题目:给定一个数组 prices ,它的第 i 个元素 prices[i] 表示一支给定股票第 i 天的价格。 你只能选择 某一天 买入这只股票,并选择在 未来的某一个不同的日子 卖出该 ......
Leetcode 股票 问题

CF1861B Two Binary Strings

## 思路 ~~最近熬夜打 CF,视力下降了。没看到题目里给了第一位和最后一位必定是 $0$ 和 $1$,导致想了半天。~~ 考虑枚举字符串的位置 $i$。 首先如果遇到了两个串第 $i$ 位都是 $1$,那么可以直接覆盖中间的片段,一定能成功。 如果遇到不同的位置,考虑找到最近的 $0$ 与第一位 ......
Strings Binary 1861B 1861 Two

刷题[Leetcode]3. 无重复字符的最长子串

3. 无重复字符的最长子串 class Solution { public: int lengthOfLongestSubstring(string s) { if (s.size() == 0) return 0; unordered_set<int> unset; int maxLen = 0; ......
字符 Leetcode

LeetCode952三部曲之二:小幅度优化(137ms -> 122ms,超39% -> 超51%)

### 欢迎访问我的GitHub > 这里分类和汇总了欣宸的全部原创(含配套源码):[https://github.com/zq2599/blog_demos](https://github.com/zq2599/blog_demos) ### 本篇概览 - 本文是《LeetCode952三部曲》系 ......
三部曲 幅度 LeetCode ms 952

string

String String 全局对象是一个用于字符串或一个字符序列的构造函数。 字符串字面量采取以下形式: 'string text' "string text" "中文/汉语" "español" "English " "हिन्दी" "العربية" "português" "বাংলা" ......
string

LOOKUP函数和FIND函数套用实例

LOOKUP函数和FIND函数套用,主要是通过LOOKUP函数的查找区域是模糊查找,找到小于或等于查找值的最大值,且忽略错误数据,再用0除以FIND函数查找到的结果数组,使其成为一组包含0和错误值的数组。这样LOOKUP函数查找值只需要比0大或者等于0都能够匹配到FIND函数找到的那行数据,然后通过 ......
函数 实例 LOOKUP FIND

leetcode139 单词拆分

下面采用穷举的方法。但是超时。 注意:题目示例中看起来输出是字符串‘true’or'false'。但是实际输出是bool类型,所以在下面程序中进行了转换。 class Solution: def __init__(self): self.ans='false' def wordBreak(self, ......
单词 leetcode 139

leetcode226 翻转二叉树——简单

# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self. ......
leetcode 226

leetcode题库39.组合总和——递归 穷举

class Solution: def combinationSum(self, candidates, target): res,ans=[],[] def findpath(candidates): if sum(ans)==target: res.append(ans.copy()) retu ......
题库 总和 leetcode 39

incorrect string value问题的解决

# 问题描述 其实,就是字符集出现问题了; # 问题解决 之前没有连接Linux系统时,字段种都默认可以使用中文; 连接之后,忘记更改,在**设计表**中,将字符集名称均改为**utf8bm4**即可; 在Navicat里面连接了Linux系统的mysql,直接在Navicat里面进行数据管理,Li ......
incorrect string 问题 value

[LeetCode] 2707. Extra Characters in a String

You are given a 0-indexed string s and a dictionary of words dictionary. You have to break s into one or more non-overlapping substrings such that eac ......
Characters LeetCode String Extra 2707

[LeetCode] 1921. Eliminate Maximum Number of Monsters

You are playing a video game where you are defending your city from a group of n monsters. You are given a 0-indexed integer array dist of size n, whe ......
Eliminate LeetCode Monsters Maximum Number

新人笔记-StringBuilder与String的转化

/* StringBuilder转化为String public String toString();通过toString()就可以实现 String转化为StringBulider public StringBuilder(String);通过构造方法实现 */ public class Stri ......
StringBuilder 新人 笔记 String

FastJson中将JSON解析成对象时发生错误:Exception in thread “main“ java.lang.ClassFormatError: Illegal UTF8 string

转: FastJson中将JSON解析成对象时发生错误:Exception in thread “main“ java.lang.ClassFormatError: Illegal UTF8 string 原因 实体类 路径不能包含中文 包的名称包含了中文 解决方法 将包的名称中的中文字符删除,就不 ......

Leetcode 剑指 Offer 58 - II. 左旋转字符串(Zuo xuan zhuan zi fu chuan lcof)

[题目链接](https://leetcode.cn/problems/zuo-xuan-zhuan-zi-fu-chuan-lcof) 字符串的左旋转操作是把字符串前面的若干个字符转移到字符串的尾部。请定义一个函数实现字符串左旋转操作的功能。比如,输入字符串"abcdefg"和数字2,该函数将返回 ......
左旋 字符串 字符 Leetcode Offer

1335B - Construct the String

## B. Construct the String https://codeforces.com/problemset/problem/1335/B #### 分析: 首先不要被他的示例迷惑掉,这个问题可以看作若干个小问题 Q: 1. 如何简单的构造a个长度里有b个不同的值 2. 如何是n里的所有 ......
Construct String 1335B 1335 the

Leetcode刷题笔记——二分法

二分法是搜索算法中极其典型的方法,其要求输入序列有序并可随机访问。算法思想为 输入:有序数组nums,目的数值target 要求输出:如果target存在在数组中,则输出其index,否则输出-1 1. 将原数组通过[left,right]两个索引划分范围,初值left=0,right=数组的最后一 ......
二分法 Leetcode 笔记

LeetCode952三部曲之一:解题思路和初级解法(137ms,超39%)

### 欢迎访问我的GitHub > 这里分类和汇总了欣宸的全部原创(含配套源码):[https://github.com/zq2599/blog_demos](https://github.com/zq2599/blog_demos) ### 题目描述 - 难度:**困难** - 编程语言:Jav ......
解法 三部曲 LeetCode 思路 952

[LeetCode] 1560. Most Visited Sector in a Circular Track

Given an integer n and an integer array rounds. We have a circular track which consists of n sectors labeled from 1 to n. A marathon will be held on t ......
LeetCode Circular Visited Sector Track

[LeetCode] 2511. Maximum Enemy Forts That Can Be Captured

You are given a 0-indexed integer array forts of length n representing the positions of several forts. forts[i] can be -1, 0, or 1 where: -1 represent ......
LeetCode Captured Maximum Enemy Forts

记录:阅读 C# 中string的源码

## string ### Unsafe.Add `Unsafe.Add` 是string中一个常用的方法,它不是用于向某个对象添加元素的,而是用于计算字符在内存中的偏移位置。 ### Split 是如何运行的 string 的 split 操作是直接进行内存操作实现的,这样可以在不创建大量新字符串 ......
源码 string

【Leetcode刷题记录】1、买钢笔和铅笔的方案数;2、一个图中连通三元组的最小度数;3、带因子的二叉树

1、买钢笔和铅笔的方案数 题目:给你一个整数 total ,表示你拥有的总钱数。同时给你两个整数 cost1 和 cost2 ,分别表示一支钢笔和一支铅笔的价格。你可以花费你部分或者全部的钱,去买任意数目的两种笔。 请你返回购买钢笔和铅笔的 不同方案数目 。 思路:枚举法。 假设 total 最多可 ......
度数 钢笔 因子 铅笔 Leetcode

[LeetCode][494]target-sum

# Content You are given an integer array nums and an integer target. You want to build an expression out of nums by adding one of the symbols '+' and ......
target-sum LeetCode target 494 sum

[LeetCode][416]partition-equal-subset-sum

# Content Given an integer array nums, return true if you can partition the array into two subsets such that the sum of the elements in both subsets i ......

python f-string

python | f-string_cuckooman的博客-CSDN博客 >>> a = 'hello' >>> b = 12.23456 >>> f'{a}' 'hello' >>> F'{a}' # f支持大写和小写混用 'hello' >>> f'{a=}' # 直接以a=的形式打印值 "a ......
f-string python string

Leetcode 151. 反转字符串中的单词(Reverse words in a string)

[题目链接](https://leetcode.cn/problems/reverse-words-in-a-string) 给你一个字符串 s ,请你反转字符串中 单词 的顺序。 单词 是由非空格字符组成的字符串。s 中使用至少一个空格将字符串中的 单词 分隔开。 返回 单词 顺序颠倒且 单词 之 ......
字符串 单词 字符 Leetcode Reverse

LeetCode46全排列(回溯入门)

### 欢迎访问我的GitHub > 这里分类和汇总了欣宸的全部原创(含配套源码):[https://github.com/zq2599/blog_demos](https://github.com/zq2599/blog_demos) ### 题目描述 - 难度:中等 - 给定一个不含重复数字的数 ......
LeetCode 46

[LeetCode] 2240. Number of Ways to Buy Pens and Pencils

You are given an integer total indicating the amount of money you have. You are also given two integers cost1 and cost2 indicating the price of a pen ......
LeetCode Pencils Number 2240 Ways

configure: error: Can't find GL/gl.h. Look for Mesa devel packages for your distro.

1. 安装文件查询工具 sudo apt install plocate 2. 查询头文件地址,shell命令: locate GL/gl.h 3. 为编译时指定其他的头文件查询地址: export CPLUS_INCLUDE_PATH=/usr/include ......
configure for packages distro error