difference leetcode string 2451
LeetCode day 1
class Solution { public: vector<int> sortArrayByParityII(vector<int>& nums) { int n = nums.size(); vector<int> even; // 存储偶数 vector<int> odd; // 存储奇数 ......
leetcode
# 最长回文子串 class Solution: def longestPalindrome(self, s: str) -> str: return self.manacher(s) @staticmethod def manacher(s: str) -> str: # 如果s是单字符的字符串, ......
C# String 字符串转换为base64
string 转换为 base64 public string str2Base64( string str) { byte[] b = System.Text.Encoding.UTF8.GetBytes(str); string result= Convert.ToBase64String(b) ......
Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range
在使用浏览器内置API btoa() 编码base64时: 报错Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range 报错信息解释: ......
Leetcode 59. 螺旋矩阵 II && 剑指 Offer 29. 顺时针打印矩阵
这两个题非常相似,但是前者较为简单,后者较难。 由于前者访问的矩阵是方阵,因此可以通过迭代去做(因为方阵每次迭代,长和宽缩水的大小是一样的,但是矩阵不可以,因为矩阵最后一次迭代,长和宽的缩水不一定一样) class Solution { public: vector<vector<int>> gen ......
LeetCode -- 777. 在LR字符串中交换相邻字符
给两种不同元素,可以和第三种元素交换位置,L只能向左走,R只能向右走,问start数组可否经过某些变换变换到end。 经典双指针算法。 class Solution { public: bool canTransform(string start, string end) { int n = sta ......
面试官:String.intern() 有什么用?和常量池有什么关系?问倒一大片!
作者:GuoMell \ 来源:blog.csdn.net/gcoder_/article/details/106644312 ## **0. Background** 在 JAVA 语言中有8中基本类型和一种比较特殊的类型String。这些类型为了使他们在运行过程中速度更快,更节省内存,都提供了一 ......
Leetcode 242. 有效的字母异位词(Valid anagram)
[题目链接🔗](https://leetcode.cn/problems/valid-anagram) 给定两个字符串s和t, 编写一个函数来判断t是否是s的字母异位词. 注意: 若s和t中每个字符出现的次数都相同, 则称s和t互为字母异位词. 示例 1: ``` 输入: s = "anagram ......
LeetCode 周赛上分之旅 #41 结合离散化的线性 DP 问题
> ⭐️ **本文已收录到 AndroidFamily,技术和职场问题,请关注公众号 \[彭旭锐] 和 [BaguTree Pro](https://www.mdnice.com/writing/85b28c4e60354865a423728e668fc570) 知识星球提问。** > > 学习数据 ......
LeetCode —— 二分查找
33. 搜索旋转排序数组 翻转点在前半部分 nums[mid]<=nums[low] 而后半部分是单调递增的,比较好判断。可以判断 nums[mid] < target <= nums[high] 去后半部分 else 去后半部分 翻转点在后半部分 nums[mid]<=nums[low] 而前半部 ......
LeetCode 周赛上分之旅 #40 结合特征压缩的数位 DP 问题
> ⭐️ **本文已收录到 AndroidFamily,技术和职场问题,请关注公众号 \[彭旭锐] 和 [BaguTree Pro](https://www.mdnice.com/writing/85b28c4e60354865a423728e668fc570) 知识星球提问。** > > 学习数据 ......
LeetCode -- 第 359 场周赛
本题我们只需要将所有首字母取出来,并与s比较即可。 class Solution { public: bool isAcronym(vector<string>& words, string s) { string res; for(auto &it: words) { res += it[0]; ......
IDEA 刷题工具 leetcode editor
突然有一天不好用了,然后抓取新的 cookie 后也登陆不上 https://github.com/shuzijun/leetcode-editor/issues/402 ![](https://img2023.cnblogs.com/blog/2171496/202308/2171496-2023 ......
3.你所不知道的go语言控制语句——Leetcode习题69
[TOC] # 本篇前瞻 好的,现在你已经来到一个新的小结,在这里你将学习到go语言的重要内容,习得go 25个关键字中的12个:var, const, if, else, switch, case, default, fallthrough, for, break, goto, continue, ......
LeetCode
# 字符串 #### 左旋转字符串 [剑指 Offer 58 - II. 左旋转字符串](https://leetcode.cn/problems/zuo-xuan-zhuan-zi-fu-chuan-lcof/description/?envType=study-plan-v2&envId=cod ......
leetcode: TC of top-down memorization
example to explain how to calculate Time Complexity the memo size means each state will be calculated only once how about the TC in each state? class ......
【leetcode】剑指-68.1 二叉搜索树的最近公共祖先
## 思路 首先保证传入的p.valroot.val`: goto right tree ## 代码 第一版,递归法 ``` class Solution { public: TreeNode* get_ancestor(TreeNode* root, TreeNode* p, TreeNode* ......
leetcode2235 两整数相加
题目描述:(这第一种方法我就不多说了,肯定是有手就行) 给你两个整数 num1 和 num2,返回这两个整数的和。 示例 1: 输入:num1 = 12, num2 = 5 输出:17 解释:num1 是 12,num2 是 5 ,它们的和是 12 + 5 = 17 ,因此返回 17 。 示例 2: ......
Leetcode 146 LRUCache
```c /* * * Copyright (C) 2023-08-18 13:51 zxinlog * */ #include #define N 1000 // 普通Node typedef struct Node { int key; int value; struct Node *prev; ......
Oracle 12C 新特性-扩展数据类型,在12c中,与早期版本相比,诸如VARCHAR2, NAVARCHAR2以及 RAW这些数据类型的大小会从4K以及2K字节扩展至32K字节。只要可能,扩展字符的大小会降低对LOB数据类型的使用。为了启用扩展字符大小,你必须将MAX_STRING_SIZE的初始数据库参数设置为EXTENDED。
1.查看参数max_string_size默认值 SQL> show parameter max_string_size NAME TYPE VALUE max_string_size string STANDARD 2. 关闭数据库SQL> shutdown immediate; 3. 以升级模式 ......
【LeetCode1384. 按年度列出销售总额】MySQL使用with recursive根据开始日期和结束日期展开为多行
# 题目地址 https://leetcode.cn/problems/total-sales-amount-by-year/description/ # 代码 ``` WITH RECURSIVE DateSeries AS ( SELECT product_id, period_start AS ......
【LeetCode2199. 找到每篇文章的主题】字符串处理题,使用MySQL里的group_concat和LOCATE函数完成
# 题目地址 https://leetcode.cn/problems/finding-the-topic-of-each-post/description/ # 代码 ``` with t1 as( select p.*, k.* from Posts p left join Keywords k ......
Leetcode 142. 环形链表II(Linked list cycle ii)
[题目链接](https://leetcode.cn/problems/linked-list-cycle-ii) 给定一个链表的头节点head, 返回链表开始入环的第一个节点。. 如果链表无环, 则返回 null. 如果链表中有某个节点, 可以通过连续跟踪next指针再次到达, 则链表中存在环. ......
【LeetCode2118. 建立方程】 group_concat指定分隔符,指定排序顺序
[TOC] # 题目地址 https://leetcode.cn/problems/build-the-equation/description/ # 题目描述 ``` Example 2: 输入: Terms 表: + + + | power | factor | + + + | 4 | -4 | ......
String类
Java中的String类是用于处理字符串的核心类之一。以下是关于Java String类的一些重要知识点:1. **不可变性(Immutability)**: String对象一旦被创建,其内容就不能被修改。任何对String对象的修改都会创建一个新的String对象。这种特性有助于确保字符串在多 ......
【LeetCode1225. 报告系统状态的连续日期】MySQL使用lag,lead得到连续段的:开始标志,结束标志,分组号,长度
[TOC] # 题目地址 https://leetcode.cn/problems/report-contiguous-dates/description/ # 题目描述 A system is running one task every day. Every task is independen ......
【LeetCode173. 最多连胜的次数】MySQL用户变量编程解法
[TOC] # 题目地址 https://leetcode.cn/problems/longest-winning-streak/description/ # 题目描述 选手的 连胜数 是指连续获胜的次数,且没有被平局或输球中断。 编写解决方案来计算每个参赛选手最多的连胜数。 结果可以以 任何顺序 ......
【LeetCode1454. 活跃用户】MySQL 用户自定义变量,面向过程编程解决"连续天数"的问题
[TOC] # 题目地址 https://leetcode.cn/problems/active-users/description/ # 题目描述 活跃用户 是指那些至少连续 5 天登录账户的用户。 编写解决方案, 找到 活跃用户 的 id 和 name。 返回的结果表按照 id 排序 。 # 代 ......
leetcode刷题日记
unordered_set散列哈希表:[C++ STL unordered_set容器完全攻略 (biancheng.net)](http://c.biancheng.net/view/7250.html) unordered_map:[详细介绍C++STL:unordered_map - 朤尧 - ......
CodeForces 1860D Balanced String
[洛谷传送门](https://www.luogu.com.cn/problem/CF1860D "洛谷传送门") [CF 传送门](https://codeforces.com/problemset/problem/1860/D "CF 传送门") 首先考虑一个子问题,给两个只含有 $0$ 和 $ ......