leetcode day9 day

day 02-1 快速上手

day 02 快速上手 1.编码 计算机中所有的数据本质上都是以0和1的组合来存储。 2.编程初体验 编码必须要保持:保存和打开一直,否则会乱码。 默认Python解释器是以 UTF-8 编码的形式打开文件。 建议:所有Python代码文件的都要以UTF-8编码保存和读取。 3.输出 print ( ......
day 02

Day22 Switch多选择结构

Switch多选择结构 多选择的除了if结构外 的另一个实现方式:Switch case语句(判断一个变量与一系列值中某个值是否相等,每个值称为一个分支) Switch语句中的变量可以是:byte, short, int 或者 char ​ 从Java SE7开始 Switch开始 支持字符串Str ......
结构 Switch Day 22

【LeetCode-中等-链表】两数相加

这是个关于链表的题目, 以前在C#中写代码时,对链表接触比较少,所以刚好接这个题目来更好的熟悉一下链表 题目大概是这样的,给你两个非空的链表,表示两个非负的整数. 它们每位数字都是按照逆序的方式存储的,并且每个节点只能存储一位数字 =》 首先我们来理解这句话是什么意思 我们来看一个链表 1->5-> ......
LeetCode

[LeetCode Hot 100] LeetCode2. 两数相加

题目描述 思路:模拟 每次3个数相加:l1链表的值 + l2链表的值 + 进位 如果 l1链表不为空 或者 l2链表不为空 或者 进位不为0 我们就执行循环 那么和存储的是 t % 10 进位就是t / 10 因为题目需要创造一条链表,所以我们创建一个dummy结点的话会方便一点。 方法一: /** ......
LeetCode LeetCode2 Hot 100

LeetCode876. 链表的中间结点

题目描述 思路:快慢指针 快指针一次走两步 慢指针一次走一步 当快指针到达末尾的时候,慢指针所指的就是链表的中点 方法一: /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode ......
结点 LeetCode 876

[LeetCode Hot 100] LeetCode86. 分隔链表

题目描述 思路 可以将链表分成两个小链表,一个链表中的元素大小都小于x,另一个链表中的元素都大于等于x,然后再把这两条链表连接到一起,就得到题目想要的结果。 这个题类似于合并两个有序链表:只不过另一个链表只有唯一一个节点x。 合并这两个链表。 方法一: /** * Definition for si ......
LeetCode Hot 100 86

[LeetCode Hot 100] LeetCode23. 合并K个升序链表

题目描述 思路:优先队列 使用优先队列这个数据结构,对于这个数据结构,我们不用去管内部是如何实现的,我们只要知道有这么一种数据结构能帮助我们将一堆数据塞到优先队列这一个黑盒中,然后我们可以获取这堆数中最小的值或者最大的值。 代码一: /** * Definition for singly-linke ......
LeetCode 升序 Hot 100 23

LOJ6039 「雅礼集训 2017 Day5」珠宝

LOJ 传送门 显然枚举物品做背包没有前途,于是我们把体积相等的物品捆绑在一起。 设 \(f_{i, j}\) 为考虑完体积 \(\in [1, i]\) 的物品,背包容量为 \(j\) 的最大值。可以贪心求出 \(g_{i, j}\) 为选 \(j\) 个体积为 \(i\) 的物品的价值最大值。 ......
珠宝 6039 2017 Day5 LOJ

day16 软件开发规范 os json模块

模块本质上就是一个.py文件 里面有函数 有变量 包aaa被导入的时候发生的事情:①包aaa里面的__init__.py文件被打开②py解释器运行解释__init__.py文件 __init__.pyw文件里面的名字被丢入包aaa的名称空间③导入包其实就是导入__init__.py文件里面的名字 i ......
软件开发 模块 软件 json day

leetcode中SQL学习

https://leetcode.cn/studyplan/sql-free-50/ 查询 可回收且低脂的产品 表:Products + + + | Column Name | Type | + + + | product_id | int | | low_fats | enum | | recyc ......
leetcode SQL

The second day learning summary

1.什么是接口测试? 接口测试是测试系统组件间接口的一种测试。接口测试主要用于外部系统与系统之间以及内部各个子系统之间的交互点,定义特定的交互点,然后通过这些交互点来,通过一些特殊的规则也就是协议,来进行数据之间的交互。测试的重点是要检查数据的交换,传递和控制管理过程,以及系统间的相互逻辑依赖关系等 ......
learning summary second The day

[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 ......
Calculate LeetCode Leetcode Money 1716

阅读《Effective c++》第三版 day 3

本系列是我在阅读《Effective C++》时的思考及感悟,希望让更多学习C++的人看到学习,并希望指出文章有错误之处,我愿意接受指正。 ......
Effective day

Day21 顺序结构及选择结构中的If结构

顺序结构 Java的基本结构就是顺序结构,从上到下的顺序执行,是任何一种算法都离不开的基本算法结构 package com.baixiaofan.struct; public class ShunXuDemo { public static void main(String[] args) { Sy ......
结构 顺序 Day 21

Leetcode刷题day7-字符串.反转ⅠⅡ.反转单词.右旋转

344.反转字符串 344. 反转字符串 - 力扣(LeetCode) 编写一个函数,其作用是将输入的字符串反转过来。输入字符串以字符数组 s 的形式给出。 不要给另外的数组分配额外的空间,你必须原地修改输入数组、使用 O(1) 的额外空间解决这一问题。 示例 1: 输入:s = ["h","e", ......
字符串 单词 字符 Leetcode day7

java与算法Day1 Scanner的应用(一)

java中使用输入需要用到java.util.Scanner。Scanner有next,nextInt,nextString,hasNext,hasNextLine等方法。 使用 XXX variable = Scanner.NextXXX就可以获取一个输入值。next系列的方法,他们的作用都是从键 ......
算法 Scanner java Day1 Day

day15 模块基础 continued

2023年12月6日 周三 13:16:00循环导入:两个文件f1 f2互相import而出现的问题 代码自上而下运行 可能有时候需要导入的名字在f1里面还未生成 f2就调用这个名字 就会报错解决方案:①先生成名字 再import②把import放入函数体内 因为在定义函数的时候 只检测语法 不运行 ......
continued 模块 基础 day 15

day 01 计算机基础和环境搭建

1.计算机基础 1.1 基本概念 计算机的组成 计算机是由多个硬件组合而成,常见的硬件有:CPU、硬盘、内存、网卡、显示器、机箱、电源... 操作系统 用于协调计算机的各个硬件,让硬件之间协作工作,以完成某个目标 - Windows - Linux - Mac 软件 在安装上操作系统之后,我们会在自 ......
环境 计算机 基础 day 01

[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上看了个印度老 ......
对角线 对角 LeetCode Diagonal Traverse

[LeetCode Hot 100] LeetCode73. 矩阵置零

题目描述 思路一:开辟两个数组,时间复杂度O(m + n) 开辟两个数组用来记录哪些行、哪些列需要置为零。 这样时间复杂度为O(m + n)。 思路二: 原地算法:不适用额外空间或者说常数级空间来实现算法。 类似于使用set保存每行每列是否需要置零, 方法一:对应思路一 class Solution ......
LeetCode 矩阵 Hot 100 73

leetcode-1662-easy

Check If Two String Arrays are Equivalent 思路一:把第一个数组入队列,然后遍历比较第二个数组 public boolean arrayStringsAreEqual(String[] word1, String[] word2) { Deque<Charac ......
leetcode 1662 easy

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 1732 easy

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 1646 easy

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 2169 easy

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 2180 easy

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 1455 easy

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 1464 easy

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 1512 easy

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 1550 easy

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 ......
leetcode 1572 easy