leetcode numbers add two

[LeetCode] 1979. Find Greatest Common Divisor of Array

Given an integer array nums, return the greatest common divisor of the smallest number and largest number in nums. The greatest common divisor of two ......
LeetCode Greatest Divisor Common Array

[LeetCode] 2807. Insert Greatest Common Divisors in Linked List

Given the head of a linked list head, in which each node contains an integer value. Between every pair of adjacent nodes, insert a new node with a val ......
LeetCode Greatest Divisors Insert Common

leetcode 4. 寻找两个正序数组的中位数

leetcode 4. 寻找两个正序数组的中位数 第四题:寻找两个正序数组的中位数 1.合并数组,排序,找中位数 ​ 暴力解法,时间复杂度(M+N),空间复杂度(M+N) public double findMedianSortedArrays(int[] nums1, int[] nums2) { ......
中位数 数组 leetcode 两个

CF1870F Lazy Numbers 题解

CF1870F 题意:给一个长度为 \(n\) 的排列,求在其在 \(k\) 进制下按字典序排序后 \(\sum[p_i=i]\) 的值(\(n\le10^{18}\))。 直接做是不好办的,只能在一些数中找到 \(p_i\) 的大小关系。 在手摸的过程中会发现一些长度相等的数之间会插入一些其它长度 ......
题解 Numbers 1870F 1870 Lazy

分治法LeetCode经典例题(c语言解法)

多数元素https://leetcode.cn/problems/majority-element/description/ `//计数 int count(int* nums,int target,int left,int right){ int cnt = 0; for(int i = left ......
解法 例题 LeetCode 语言 经典

select row_number() over(partition by column1 order by column2 desc

场景 定时任务,及定时任务结果两个表。 需要查询定时任务及最后一次执行结果数据 select t.task_id, t.task_name, t.task_desc,t.cron, t.task_status, b.task_result_status from dg_de_task t left ......
column row_number partition column1 column2

antdv1.7.8 a-input-number限制正整数和0

<a-input-number :precision="0" :min="0" /> min限制输入最小值为0,precision限制小数位数为0。 ......
整数 a-input-number antdv1 number antdv

Docker 入门系列(7)- Dockerfile 使用(FROM、RUN、CMD、EXPOSE、ENV、ADD、COPY、ENTRYPOINT、VOLUME、WORKDIR)

https://blog.csdn.net/wohu1104/article/details/85227644 ———————————————————————————————————————————————————————————————— Dockerfile 是一个文本格式的配置文件,用户可以使 ......
Dockerfile ENTRYPOINT WORKDIR Docker EXPOSE

Leetcode 2982. 找出出现至少三次的最长特殊子字符串 II

开26个multiset,对于aabaaa,遍历,对第0个multiset push 1 2,然后对第一个multiset push 1,然后又对第0个multiset push 1 2,这时第0个multiset size超过3了,删除最小的元素,然后继续push 3,最后取 \(max_{i=1 ......
字符串 字符 Leetcode 2982 II

使用Cookie在VS Code中登录LeetCode插件

在VS Code的LeetCode插件中使用Cookie登录 1 在浏览器中打开leetcode网页并登录进去 2 按F12查看网页元素,找到graphql,查看其中的cookie,复制该cookie 3 在VS Code中点击登录leetcode的按钮,在登录方式中选择使用cookie登录,然后将 ......
插件 LeetCode Cookie Code

IDEA 2023.3 使用gitlab弹出Add GitLab Account 提示

更新代码时提示,且按照提示执行完操作后,无法正常认证。 经本人测试,关闭IDEA自带Gitlab插件就会弹出用户名和密码认证框。 感觉应该是这个插件有点问题。用api post测试接口是可以正常访问的。 ......
Account 2023.3 GitLab gitlab IDEA

586. Customer Placing the Largest Number of Orders

参考官方题解:https://leetcode.cn/problems/customer-placing-the-largest-number-of-orders/solutions/2366301/ding-dan-zui-duo-de-ke-hu-by-leetcode-so-bywe/ 首先我 ......
Customer Placing Largest Number Orders

leetcode 3.无重复字符的最长子串

leetcode 第三题:无重复字符的最长子串 自己写的: 第一想法:滑动窗口,用两个指针指向窗口的左右边界,用一个HashSet存储窗口内已有的值。另写一个find_first_temp方法用于出现重复字符时寻找新的左边界,左边界更新时也要更新set,将新左边界之前的元素删掉。 public in ......
字符 leetcode

JS 根据文件Magic Number判断文件是否是图片

原理:检测文件的 Magic Number 代码示例: var pngMagic = [ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a ]; var jpeg_jfif = [ 0x4a, 0x46, 0x49, 0x46 ]; var jpeg_ex ......
文件 Number 图片 Magic JS

leetcode 2.两数相加

leetcode 第二题:两数相加 以链表为载体模仿加法进位,同时遍历两个链表,逐位计算它们的和,并与当前位置的进位值相加。如果两个链表的长度不同,则可以认为长度短的链表的后面有若干个 0 。如果链表遍历结束后,有 carry>0,还需要在答案链表的后面附加一个节点,节点的值为 carry。 易错点 ......
leetcode

B. Two Divisors

原题链接 题记 1.题目漏了个说明条件,应该说明所给数据一定能找到对应的x 例如a=2,b=6就找不到相对应的x 2.如果一定存在对应的x,那么b一定是x除以x最小的因子,a一定是x除以x第二小的因子 如果第二小的因子不是由第一小的因子的平方得到的,那么\(lcm(a,b)\)一定能找到x 否则再乘 ......
Divisors Two

CF1916B Two Divisors

思路 看到题目要求求一个数 \(x\),满足它的最大的两个因数分别是 \(a\) 和 \(b\),并且规定一个数本身不是他的因数。 首先 \(x\) 需要是 \(a\) 和 \(b\) 的倍数,所以想到最小公倍数,如果不考虑最小公倍数等于 \(b\),最小公倍数就一定是答案,因为最小公倍数是最小的满 ......
Divisors 1916B 1916 Two CF

leetcode 1.两数之和

leetcode 第一题:两数之和 1.暴力枚举: 最容易想到的方法是枚举数组中的每一个数 x,寻找数组中是否存在 target - x。 当我们使用遍历整个数组的方式寻找 target - x 时,需要注意到每一个位于 x 之前的元素都已经和 x 匹配过,因此不需要再进行匹配。而每一个元素不能被使 ......
之和 leetcode

Applied Statistics - 应用统计学习 - numpy array交换两行 ? How to Swap Two Rows in a NumPy Array (With Example)

https://www.statology.org/qualitative-vs-quantitative-variables/ https://www.statology.org/numpy-swap-rows/ How to Swap Two Rows in a NumPy Array (Wit ......
Statistics Applied Example Array NumPy

leetcode 2706 购买两块巧克力

题目: 2706 购买两块巧克力 思路: 找两个最小值。 分情况讨论 代码 class Solution: def buyChoco(self, prices: List[int], money: int) -> int: # 遍历一遍,找2个最小值 # 找一个最小值我们都会。 # 找次小值,就分两 ......
巧克力 leetcode 2706

在不使用内置函数和中间变量的情况交换数字LeetCode力扣题解面试题16.01

#异或法#Kotlin ```Kotlinclass Solution { fun swapNumbers(numbers: IntArray): IntArray { numbers[0] = numbers[0] xor numbers[1] numbers[1] = numbers[1] xo ......
题解 变量 函数 LeetCode 情况

[LeetCode] 1578. Minimum Time to Make Rope Colorful

Alice has n balloons arranged on a rope. You are given a 0-indexed string colors where colors[i] is the color of the ith balloon. Alice wants the rope ......
LeetCode Colorful Minimum 1578 Make

[LeetCode Hot 100] LeetCode111. 二叉树的最小深度

题目描述 思路 二叉树的最小深度就是第一个叶子节点所在的层数 方法一:前序遍历(递归、dfs) /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeN ......
LeetCode 深度 Hot 100 111

[LeetCode Hot 100] LeetCode110. 平衡二叉树

题目描述 思路 LeetCode104. 二叉树的最大深度 变种 方法一:后序遍历(递归、dfs) /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * Tre ......
LeetCode Hot 100 110

[LeetCode Hot 100] LeetCode543. 二叉树的直径

题目描述 思路 所谓二叉树的直径,就是左右子树的最大深度之和。 方法一: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; ......
LeetCode 直径 Hot 100 543

[LeetCode Hot 100] LeetCode104. 二叉树的最大深度

题目描述 思路 熟练掌握二叉树的遍历算法 方法一:层序遍历(迭代)+计数 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; ......
LeetCode 深度 Hot 100 104

[LeetCode Hot 100] LeetCode102. 二叉树的层序遍历

题目描述 思路 方法一:递归 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * Tree ......
LeetCode Hot 100 102

[LeetCode Hot 100] LeetCode144. 二叉树的前序遍历

题目描述 思路 熟练掌握迭代和递归的代码。 递归代码:额外写一个函数void preOrder(TreeNode node, List res) 迭代代码:会用到数据结构——栈。先入栈当前节点的右子节点,再入栈左子节点。 方法一:递归 /** * Definition for a binary tr ......
LeetCode Hot 100 144

[LeetCode Hot 100] LeetCode94. 二叉树的中序遍历

题目描述 思路 熟练掌握迭代和递归的代码。 递归:额外写一个函数void inOrder(TreeNode node, List res) 迭代:令cur = root,一直往左子树找,找到最后一个左子节点,当cur为空,就开始处理栈顶元素(将栈顶元素加入结果集),随后将cur设置为右子节点,继续执 ......
LeetCode Hot 100 94

[LeetCode Hot 100] LeetCode145. 二叉树的后序遍历

题目描述 思路 递归:额外写一个函数void postOrder(TreeNode node, List res) 迭代: 前序遍历:根 左 右 将前序遍历改造成:根 右 左 然后反转根右左为:左 右 根,即为后序遍历 优化一下: while (!stack.isEmpty()) { TreeNod ......
LeetCode Hot 100 145
共2030篇  :2/68页 首页上一页2下一页尾页