leetcode anagrams string find
[LeetCode][32]longest-valid-parentheses
# Content Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses substring. Examp ......
[LeetCode][64]minimum-path-sum
# Content Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along ......
LeetCode[10]RegularExpressionMatching
# Content Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where: '.' Matches any single ch ......
LeetCode[32]LongestValidParentheses
# Content Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses substring. Examp ......
LeetCode[42]TrappingRainWater
# Content Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raini ......
LeetCode[53]MaximumSubarray
# Content Given an integer array nums, find the subarray with the largest sum, and return its sum. Example 1: Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Ou ......
LeetCode[62]UniquePaths
# Content There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the ......
LeetCode[55]JumpGame
# Content You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your ......
LeetCode[64]MinimumPathSum
# Content Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along ......
【LeetCode1270. 向公司CEO汇报工作的所有人】with recursive找到某节点所有的后代
# 题目地址 https://leetcode.cn/problems/all-people-report-to-the-given-manager/description/ # 代码 ``` WITH RECURSIVE cte_subordinates AS ( -- 基础情况: 找到直接下属 ......
【leetcode】1.two sum
第一题给我干懵了...想达到这个要求把我脑壳都想痛了...Follow-up: Can you come up with an algorithm that is less than O(n2) time complexity? 一开始想过用map,但是不能解决重复key的问题。 然而我用sort, ......
redis:string类型
学习自:Redis 的五种数据类型及其底层原理_redis的五种数据类型_ZJE_ANDY的博客-CSDN博客 Redis 的五种基本数据类型_redis的五种数据类型_喵先森爱吃鱼的博客-CSDN博客 Redis是K-V结构的数据库。 Redis有5种常用数据类型(这里的数据类型,都是针对K-V对 ......
String和Integer
# Integer 记录一下int和Integer之间相互比较的关系 ## Int和Integer 在java 5中引入了自动装箱和自动拆箱功能(boxing/unboxing),java可以根据上下文,自动进行转换,极大地简化了相关编程。javac自动把装箱转换为Integer.valueOf() ......
Unable to start activity Comandroid.content.res.Resources$NotFoundException: String resource ID #0x0
Unable to start activity Comandroid.content.res.Resources$NotFoundException: String resource ID #0x0 打开app->res->values->strings.xml文件添加 <string name= ......
LeetCode 1581. 进店却未进行过交易的顾客
##题目 表:Visits ```sql + + + | Column Name | Type | + + + | visit_id | int | | customer_id | int | + + + visit_id 是该表中具有唯一值的列。 该表包含有关光临过购物中心的顾客的信息。 ``` ......
Leetcode 19. 删除链表的倒数第N个结点(Remove nth node from end of list)
[题目链接](https://leetcode.cn/problems/remove-nth-node-from-end-of-list) 给你一个链表, 删除链表的倒数第n个结点, 并且返回链表的头结点. 示例 1: ``` 输入:head = [1,2,3,4,5], n = 2 输出:[1,2 ......
Leetcode148 排序链表
148. 排序链表 - 力扣(LeetCode) /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr ......
对于Java中String的简单理解
## String的三种初始化方式 ```java public class Test { public static void main(String[] args) { String str1 = "Hello, World !"; //直接初始化 String str2 = new Strin ......
Java面试题:String类的常用方法都有哪些?
# Java面试题:String类的常用方法都有哪些? ```java public class Test03 { /* String类常用方法 */ public static void main(String[] args) { String str1 = "Abcdefg123"; //常见S ......
LeetCode -- 151. 反转字符串中的单词(手写一个trim函数)
本题我们采用 class Solution { public: string reverseWords(string s) { stack<string> stk; int n = s.size(), l = 0, r = n - 1; //trim函数 while(l < n && s[l] == ......
购物车信息用 String 还是 Hash 存储更好呢?
在购物车信息的存储中,使用 Hash(哈希表)通常会比单纯使用 String 更合适和方便。购物车信息可能包含多个商品及其对应的数量、价格等属性,而使用单纯的 String 存储会显得不够结构化和灵活,而 Hash 则可以更好地组织和管理这些信息。 以下是使用 Hash 存储购物车信息的优势: 1. ......
第 358 场周赛 - 力扣(LeetCode)
# [第 358 场周赛 - 力扣(LeetCode)](https://leetcode.cn/contest/weekly-contest-358/) ## [2815. 数组中的最大数对和 - 力扣(LeetCode)](https://leetcode.cn/problems/max-pai ......
【leetcode】404 左叶子之和
https://leetcode.cn/problems/sum-of-left-leaves/description/ 【分析】 该题要求左叶子之和。 如果我们对当前节点进行叶子节点的判断,那么我们是不知道当前节点是左叶子还是右叶子的。 所以我们应该在叶子结点的上层(父节点)进行判断。 【代码】 ......
[LeetCode] 2682. Find the Losers of the Circular Game
There are n friends that are playing a game. The friends are sitting in a circle and are numbered from 1 to n in clockwise order. More formally, movin ......
string 操作
1 #include<bits/stdc++.h> 2 using namespace std; 3 int main(){ 4 ios::sync_with_stdio(false); 5 string s1="what about to ask ",s2="Mike telephone numb ......
LeetCode -- 19. 删除链表的倒数第 N 个结点
一般的删除问题,可以直接删除(找符合条件的,找到了直接删掉),延迟删除(打标记,找完了再删除),栈,双指针 在链表中删除一个节点,要找到其前面一个节点cur, 然后 cur -> next = cur -> next -> next即可 方法一:直接删除 我们先算出链表长度len,要删除倒第n个节点 ......
JavaSE--String类
一、String内存图 // jvm内存图 String s1 = "abcde"; String s2 = "abcde" + "zz"; String s3 = new String("yy"); 垃圾回收器不会释放常量 二、比较字符串最好使用String类中重写的equal方法 String ......
【LeetCode 571. 给定数字的频率查询中位数】WITH RECURSIVE实现Tally的逆操作
[TOC] # 题目地址 https://leetcode.cn/problems/find-median-given-frequency-of-numbers/description/ # 代码 ``` WITH RECURSIVE RecCTE AS ( SELECT num, frequenc ......
String类
String类 String用来表示一个字符串。具有以下特点: •java.lang.String使用了final修饰,不能 被继承; •字符串底层封装了字符数组及针对字符数组的操作算法; •字符串一旦创建,对象永远无法改变,但字符串引用可以重新赋值; •Java字符串在内存中采用Unicode编码 ......
【leetcode】【401】二进制手表
https://leetcode.cn/problems/binary-watch/description/ 分析 这是典型的循环DFS问题。 循环DFS一般应用在: 1. 输出字符的按位全排列。(比如一共4个数字,输出3个数字的全部组合) 2. 输出字符的全排列。(结合visited数组) 3. ......