算法leetcode day 30
初学C语言day04--数组
#### 一、数组 ###### 什么是数组: 变量的组合,是一种批量定义相同类型变量的方式 定义: 类型名 数组名[数量]; int arr[5]; 注意:数组的长度一旦确定,无法改变 ###### 使用: 数组名[下标]; 下标:从0开始,范围:0~数量-1 遍历:把数组的数据从头到尾显示或访问 ......
30天自制操作系统与操作系统真相还原书籍+源代码整理免费下载
#### **文件列表** ![image](https://img2023.cnblogs.com/blog/2507296/202307/2507296-20230719165250180-82325483.png) ### 1. `操作系统真相还原.7z` ### `https://lphco ......
代码随想录算法训练营第三十四天| 完全背包 518. 零钱兑换 II 377. 组合总和 Ⅳ
完全背包 区别: 每种物品都是可以无线多个 代码: 1 // 多背包问题 2 // 有N个物品,他们的体积和重量如下,但是这些物品有无限个 3 // 需要发挥背包的最大容量,来让价值最大 4 // 5 // dp[n]: 当容量为N的时候,背包的价值最大是多少 6 // dp[n]: 7 // dp ......
[LeetCode] 2268. Minimum Number of Keypresses
You have a keypad with 9 buttons, numbered from 1 to 9, each mapped to lowercase English letters. You can choose which characters each button is match ......
[LeetCode] 2323. Find Minimum Time to Finish All Jobs II
You are given two 0-indexed integer arrays jobs and workers of equal length, where jobs[i] is the amount of time needed to complete the ith job, and w ......
[LeetCode] 2330. Valid Palindrome IV
You are given a 0-indexed string s consisting of only lowercase English letters. In one operation, you can change any character of s to any other char ......
[LeetCode] 2340. Minimum Adjacent Swaps to Make a Valid Array
You are given a 0-indexed integer array nums. Swaps of adjacent elements are able to be performed on nums. A valid array meets the following condition ......
[LeetCode] 2422. Merge Operations to Turn Array Into a Palindrome
You are given an array nums consisting of positive integers. You can perform the following operation on the array any number of times: Choose any two ......
[LeetCode] 1676. Lowest Common Ancestor of a Binary Tree IV
Given the root of a binary tree and an array of TreeNode objects nodes, return the lowest common ancestor (LCA) of all the nodes in nodes. All the nod ......
day08 字符串01
[344.反转字符串](https://leetcode.cn/problems/reverse-string/description/) ![](https://img2023.cnblogs.com/blog/1076992/202307/1076992-20230720003559456-20 ......
vue-day32-- VueComponet构造函数
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>VueCo ......
暑期留校DAY 2-4
这三天真的一门心思搞编译器的优化啊。意识到了自己没有学好C++智能指针是一件多大的错误,真就写代码一天,debug三天555。这几天的内存泄漏,重复析构,shared_ptr循环引用的错误真的快把我折磨疯了,这种知识我之前一点都不会的啊555555555不过还好,bug都改完了,优化工作暂时也就做到 ......
LeetCode之0661, 二维向量初始化
img[i][j]周围的单元格,img[i+i1][j+j1], i1=-1,0,1, j1=-1,0,1, 每个都判断一次。O(9*m*n) class Solution { public: std::vector<std::vector<int>> imageSmoother( std::vec ......
C#选择排序(Selection Sort)算法
选择排序原理介绍 选择排序(Selection Sort)是一种简单的排序算法,其实现原理如下: 遍历待排序数组,从第一个元素开始。 假设当前遍历的元素为最小值,将其索引保存为最小值索引(minIndex)。 在剩余的未排序部分中,找到比当前最小值还要小的元素,并更新最小值索引。 在遍历结束后,将找 ......
Leetcode之0709, 修改字符串
1 class Solution { 2 public: 3 string toLowerCase(string s) { 4 for(char &ch: s){ 5 if(ch>='A' && ch<='Z'){ 6 ch=tolower(ch); 7 } 8 } 9 return s; 10 } ......
vue--day31---组件的嵌套
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>组件的嵌套 ......
装饰器/递归/算法
多层装饰 """语法糖会将紧挨着的被装饰对象的名字当做参数自动传入装饰器函数中""" # 判断七句print执行顺序 def outter1(func1): print('加载了outter1') 打印顺序③ 和前面的定义对应 def wrapper1(*args, **kwargs): print ......
C#城市线路图的纯算法以及附带求极权值
常用的数据结构写出来 纯属于算法 性方面还有待提高 时间复杂度最坏情况下O(2^n) 最优:O(n^2) 线路图为双向 带有权值 比如A-B距离是5000km 那么B-A有可能不是5000km 所以我在LoadData方法时候没做交换变量直接存放在集合里面 以起点递归查找下一连接点并返回当作起点 ......
优化基础4——分支定界法与粒子群算法
1. 分支定界算法 王源大佬在这里讲的很清楚,看这个整数规划里面的内容就可以看懂 【整数规划(三)】分支定界法及其代码实现 - 知乎 (zhihu.com) 主要在于如何分支、如何根据每个节点的上下界确定全局上下界、如何剪枝 2. 粒子群 混合粒子群算法(PSO):C++实现TSP问题 - 知乎 ( ......
Day07_3.while循环
1.while循环介绍与基本使用: 2.while循环_死循环与效率问题: 3.循环的应用: 4.while循环的结束方式一: 5.while循环的结束方式二: 6.while循环嵌套与结束案例一: 7.while循环嵌套与结束案例二: 8.while+continue: 9.while+else: ......
vue-day30--vue组件的几个注意点
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>组件的几个 ......
[LeetCode] 2486. Append Characters to String to Make Subsequence
You are given two strings s and t consisting of only lowercase English letters. Return the minimum number of characters that need to be appended to th ......
c++ day 12
前几天一直在修改八字循环的包 今天和控制接了一下,可以输出转角和速度,希望到时候实车的时候可以一步到位吧。 今天开始整数据结构。 先来理解线性表 线性表(英语:Linear List)是由n(n≥0)个数据元素(结点)a[0],a[1],a[2]…,a[n-1]组成的有限序列。 其中: 数据元素的个 ......
文心一言 VS 讯飞星火 VS chatgpt (63)-- 算法导论6.5 2题
文心一言 VS 讯飞星火 VS chatgpt (63)-- 算法导论6.5 2题 # 二、试说明 MAX-HEAP-INSERT(A,10)在堆A=(15,13,9,5,12,8,7,4,0,6,2,1)上的操作过程。 ## 文心一言: MAX-HEAP-INSERT(A, 10) 是将元素 10 ......
c语言 排序算法
// sort_algorituhm.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include <iostream> #include<algorithm> using namespace std; #define elemtype int //冒泡排序法,组 ......
[刷题记录Day4]Leetcode链表专题
# No.1 ## 题目 [两两交换链表中的节点](https://leetcode.cn/problems/swap-nodes-in-pairs/) ## 思路 - 模拟类型题目 - 两个节点前后交换,同时记住原来的下一个节点 - 虚拟头节点 ## 代码 ```Java public ListN ......
LeetCode 1201. Ugly Number III 数学+二分答案
An ugly number is a positive integer that is divisible by $a$, $b$, or $c$. Given four integers $n$, $a$, $b$, and $c$, return the $n$th ugly number. ......
初学C语言day03--数据类型及循环分支语句
##### 一、数据类型 ###### 为什么要对数据进行分类? 1、现实中的数据就是自带类别属性的 2、对数据进行分类可以节约内存存储空间、提高运行速度 ###### 存储空间的单位: Bit 比特 存储一个二进制位,只能存储0或者1,计算机存储数据的最小单位 Byte 字节 存储八个二进制位,计 ......
Day07_2.深浅copy之深copy
使用场景:如果需要拷贝一个列表,并且让两个列表的改操作完全独立开,就用深copy,否则就用浅copy深拷贝:把可变和不可变类型做了区分对待,不可变类型的指向的还是原来的值id不变,可变类型指向的是新的值id改变 1.深拷贝在拷贝原列表后会产生一个新列表id不相同: 2.深拷贝可变类型数据内的单个数据 ......