leetcode 02 07
2023-12-07:UML中的各种图形与关系
1.类图 类图描述系统静态结构。 在系统的逻辑视图中,类图用于表示类和它们之间的关系。我们利用类图来说明实体共同的角色和责任,这些实体提供了系统的行为。 类关系:类的基本联系包括关联、泛化、聚合和组合。 关联:用不带箭头的实线表示 关联连接了两个类,体现了一种语义关系。关联通常用名词词组来标注,如下 ......
聪明办法学Python-2023-拓展02
参考文章:快速掌握如何用Python debug-CSDN博客 参考视频:聊聊如何为Python程序Debug_哔哩哔哩_bilibili 拓展02 如何Debug 在计算机中 ,我们将机器看作状态机,同时我们遵循计算机不会犯错的原则,因此,当你设计的程序产生了与你意料相悖的结果,那就可以认为你的程 ......
leetcode中SQL学习
https://leetcode.cn/studyplan/sql-free-50/ 查询 可回收且低脂的产品 表:Products + + + | Column Name | Type | + + + | product_id | int | | low_fats | enum | | recyc ......
UML类图解析总结-2023/12/07
一、概述 类图是描述类、接口以及它们之间关系的图,是一种静态模型,显示了系统中各个类的静态结构。类图根据系统中的类以及各个类的关系描述系统的静态视图,可以用某种面向对象的语言实现类图中的类。 二、类之间的关系 其中由若到强的关系: 依赖 ——> 聚合 —-> 组合 1、关联关系 关联(Associa ......
[LeetCode] 1716. Calculate Money in Leetcode Bank
Hercy wants to save money for his first car. He puts money in the Leetcode bank every day. He starts by putting in $1 on Monday, the first day. Every ......
第三章 哈希表**part02**
第三章 哈希表**part02** 454.四数相加 II 题目地址 : https://leetcode.cn/problems/4sum-ii/ 基于 结点(键值对) 的 记录 multimap 基于 红黑树 时间 复杂度 O(log(n)) Code : class Solution {pub ......
02-独立按键控制led
02-独立按键控制led 按键的抖动 对于机械开关,当机械触点断开、闭合时,由于机械触点的弹性作用,一个开关在闭合时不会马上稳定地接通,在断开时也不会一下子断开,所以在开关闭合及断开的瞬间会伴随一连串的抖动 一、控制led的亮灭 按住亮松开灭 #include <REGX52.H> void mai ......
Spring入门02Spring Framework系统架构
Spring Framework系统架构 Spring Framework系统架构图 Spring Framework课程学习路线 ......
Leetcode刷题day7-字符串.反转ⅠⅡ.反转单词.右旋转
344.反转字符串 344. 反转字符串 - 力扣(LeetCode) 编写一个函数,其作用是将输入的字符串反转过来。输入字符串以字符数组 s 的形式给出。 不要给另外的数组分配额外的空间,你必须原地修改输入数组、使用 O(1) 的额外空间解决这一问题。 示例 1: 输入:s = ["h","e", ......
python07
推导式:使用推导式可以快速生成列表、元组、字典以及集合类型的数据 1.列表推导式 ①:基本格式 格式:【exp for x in list】 for--in-- 用于遍历列表(或者其他可迭代对象) exp 用于对每层循环中的列表元素进行运算 # 用循环在列表打印1~100: list = [] fo ......
[LeetCode] 498. Diagonal Traverse 对角线遍历
题目 Given an m x n matrix mat, return an array of all the elements of the array in a diagonal order. 思考 最初在纸上写写画画试了很多想法,但都没能解决,真的。。太弱了T T。 后来在YT上看了个印度老 ......
P8594 「KDOI-02」一个仇的复 题解
我会组合数! 首先发现同一列只有被不同的横块填或被一个相同的竖块填,且用竖块填完1列之后,会分成两个封闭的长方形,而长方形内部则用横块来填充。 先考虑一个子问题,某个 \(2 \times n\) 长方形内只用 \(k\) 个 \(1 \times x\) 的横块填的方案数,显然有 \(\sum\l ......
[LeetCode Hot 100] LeetCode73. 矩阵置零
题目描述 思路一:开辟两个数组,时间复杂度O(m + n) 开辟两个数组用来记录哪些行、哪些列需要置为零。 这样时间复杂度为O(m + n)。 思路二: 原地算法:不适用额外空间或者说常数级空间来实现算法。 类似于使用set保存每行每列是否需要置零, 方法一:对应思路一 class Solution ......
leetcode-1662-easy
Check If Two String Arrays are Equivalent 思路一:把第一个数组入队列,然后遍历比较第二个数组 public boolean arrayStringsAreEqual(String[] word1, String[] word2) { Deque<Charac ......
leetcode-1732-easy
Find the Highest Altitude 思路一:直接遍历 public int largestAltitude(int[] gain) { int val = 0; int max = val; for (int i : gain) { val += i; max = Math.max( ......
leetcode-1646-easy
Get Maximum in Generated Array You are given an integer n. A 0-indexed integer array nums of length n + 1 is generated in the following way: nums[0] = ......
leetcode-2169-easy
Count Operations to Obtain Zero You are given two non-negative integers num1 and num2. In one operation, if num1 >= num2, you must subtract num2 from ......
leetcode-2180-easy
Count Integers With Even Digit Sum Given a positive integer num, return the number of positive integers less than or equal to num whose digit sums are ......
leetcode-1455-easy
Check If a Word Occurs As a Prefix of Any Word in a Sentence Given a sentence that consists of some words separated by a single space, and a searchWor ......
leetcode-1464-easy
Maximum Product of Two Elements in an Array Given the array of integers nums, you will choose two different indices i and j of that array. Return the ......
leetcode-1512-easy
Number of Good Pairs Given an array of integers nums, return the number of good pairs. A pair (i, j) is called good if nums[i] == nums[j] and i < j. E ......
leetcode-1550-easy
Three Consecutive Odds Given an integer array arr, return true if there are three consecutive odd numbers in the array. Otherwise, return false. Examp ......
leetcode-1572-easy
Matrix Diagonal Sum Given a square matrix mat, return the sum of the matrix diagonals. Only include the sum of all the elements on the primary diagona ......
读程序员的README笔记02_软件的熵与技术债
1. 提出问题 1.1. 所有的工程师都应该提出问题,这是学习的一个重要部分 1.2. 新手工程师会担心打扰队友而试图自己解决所有问题,这样做既慢又没有效 1.3. 尝试自己寻找答案 1.3.1. 即使你的同事知道答案,你也要付出努力,这样你会学到更多 1.3.2. 如果你没有找到答案,当你寻求帮助 ......
[LeetCode] 1688. Count of Matches in Tournament
You are given an integer n, the number of teams in a tournament that has strange rules: If the current number of teams is even, each team gets paired ......
Leetcode 80. 删除有序数组中的重复项 II
被前面类似的题禁锢了思路,自己写的双指针,感觉题解很巧妙,记录一下。这个解法不用记录cnt。 通用解法 为了让解法更具有一般性,我们将原问题的「保留 2 位」修改为「保留 k 位」。 对于此类问题,我们应该进行如下考虑: 由于是保留 k 个相同数字,对于前 k 个数字,我们可以直接保留 对于后面的任 ......
Leetcode刷题day6-哈希表.双指针.三~四数求和.
454.四数相加Ⅱ 454. 四数相加 II - 力扣(LeetCode) 给你四个整数数组 nums1、nums2、nums3 和 nums4 ,数组长度都是 n ,请你计算有多少个元组 (i, j, k, l) 能满足: 0 <= i, j, k, l < n nums1[i] + nums2[ ......
[LeetCode Hot 100] LeetCode19. 删除链表的倒数第N个结点
题目描述 思路一:采用两次遍历 第一遍遍历先获取链表的长度length 第二次从dummy节点开始走length - n步 然后将该节点指向下下个节点 思路二:采用一次遍历 设置虚拟节点dummyHead指向head 设定双指针p和q,初始都指向虚拟节点dummyHead 移动q,直到p与q之间相隔 ......
django02
django小白必会三板斧 # 启动django项目之后 如何添加更多的功能 回想自己编写的web框架 如果要添加功能 就去urls.py和views.py # django自带重启功能 当识别到项目中代码有变化之后 隔段时间会自动重启 但是有时候较慢 # 与浏览器打交道的视图函数都应该有返回值 常 ......