摘要: 题目描述 给你一个长度为50的数字串,问你有多少个子序列构成的数字可以被3整除答案对1e9+7取模 输入描述 输入一个字符串,由数字构成,长度小于等于50 输出描述 输出一个整数 代码实现 #include<iostream> #include<string> using namespace std 阅读全文
posted @ 2024-04-09 22:02 Kellen_Gram 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 1、非递归 // 递归的归并排序 class Solution { public: ListNode* sortList(ListNode* head) { if (head == nullptr) return head; int length = 0; ListNode* node = head 阅读全文
posted @ 2024-04-01 16:28 Kellen_Gram 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 已知字符'A',给定输入数量n,怎么用最少的操作数实现得到数量n的字符'A' 操作有CtrlA,CtrlC,CtrlV,CtrlS #include <iostream> #include <vector> using namespace std; int minOperations(int n) 阅读全文
posted @ 2024-03-31 12:07 Kellen_Gram 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 开个坑,后续补解析 class Solution { public: int countSubstrings(string s) { int n = s.size(); string t = "$#"; for (const char &c: s) { t += c; t += '#'; } n = 阅读全文
posted @ 2024-03-26 10:10 Kellen_Gram 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1.题目 给你两个单词 word1 和 word2, 请返回将 word1 转换成 word2 所使用的最少操作数 。 你可以对一个单词进行如下三种操作: 删除一个字符 替换一个字符 插入一个字符 示例: 输入:word1 = "horse", word2 = "ros" 输出:3 解释: hors 阅读全文
posted @ 2024-03-26 08:46 Kellen_Gram 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 在敌人物体身上添加 Slider,将Background设置为黑色,FIllarea设置为绿色,调整滑块大小。 生命值减少代码设计如下: using System.Collections; using System.Collections.Generic; using UnityEngine; us 阅读全文
posted @ 2023-07-20 17:16 Kellen_Gram 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 1.重复子字符串问题分析 459. 重复的子字符串 - 力扣(LeetCode) 有点难度,值得反复刷;本质找 循环子串问题,可以 暴力求解或者移位 2.解法 2.0 暴力求解 设 :字符串 S 由 s'重复构成,则 S=s's's's's's' (n个s' , s' 长度为 i ); 则 :S长度 阅读全文
posted @ 2023-07-20 09:29 Kellen_Gram 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 这是一个简单题,本质上直接暴力求解也可以了。但是主要记录下哈希表的应用。 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现 阅读全文
posted @ 2023-05-17 08:51 Kellen_Gram 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 环状替换法详解 给定一个整数数组 nums,将数组中的元素向右轮转 k 个位置,其中 k 是非负数。 链接:https://leetcode.cn/problems/rotate-array 示例: 输入: nums = [1,2,3,4,5,6,7], k = 3 输出: [5,6,7,1,2,3 阅读全文
posted @ 2023-05-16 12:24 Kellen_Gram 阅读(79) 评论(1) 推荐(0) 编辑
摘要: Unity对中文字体支持较差,这里给出了几个可以使用的中文字体下载网站 后续会更新如何使用: 51Font -「免费字体发布平台」为您第一时间发布商用免费字体开源字体 (17font.com) freefonts.top/ 阅读全文
posted @ 2023-05-12 14:47 Kellen_Gram 阅读(538) 评论(0) 推荐(0) 编辑