接外包,有相关需求的可以联系我:Telegram | Email

Count Primes


Given an integer n, return the number of prime numbers that are strictly less than n. https://leetcode.com/problems/count-primes/ Solution Code python class Solution: def countPrimes(self, n: int) -> int: if n <= 1: return 0 tmp = [True] * n for i in range(2, n): if(tmp[i]): for j in range(i*i, n, ......

MySql 主从复制配置


最近又添加了几台服务器玩玩,现在有两个主机都在有数据库就想着能不能弄一个主从复制来作为数据的备份,这个数据有多重要就不需要我说了吧! 主节点配置 主机上的操作 主库在数据库配置文件添加如下,开启binlog log-bin server-id=1 重启数据库 导出主节点的所有表,并同步到子节点主机上 mysqldump -uroot -p密码 -A > /tmp/out.sql scp out.sql [email protected]子节点主机IP:/tmp/ 数据库里......

树莓派pico初体验


最近买个屏幕发现了,树莓派pico这个小东西。价格比Arduino还便宜就买回来了一个玩玩,只能说还不多,现在感觉如果没有具体的项目需求好像功能都差不多,都可以用做一些简单的小项目。唯一目前体会到的是更大的存储容量并支持Cpython。 树莓派 Pico 中文站 使用Cpython 下载UF2文件。 2、按住 Pico 开发板上的 BOOTSEL 按钮,然后将 Pico 插入树莓派或 PC 的 USB 接口,然后松开 BOOTSEL 按钮。 3、Pico 会被识别......

Factorial Trailing Zeroes


Given an integer n, return the number of trailing zeroes in n!. Note that n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1. https://leetcode.com/problems/factorial-trailing-zeroes/ Solution Count How many 5 in the n Code python class Solution: def trailingZeroes(self, n: int) -> int: ret = 0 while n >= 5: n //= 5 ret += n return ret

Missing Number


Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array. https://leetcode.com/problems/missing-number/ code python class Solution: def missingNumber(self, nums: List[int]) -> int: # 应该的总和 - 实际的总和 return (len(nums) * (len(nums) + 1)) // 2 - sum(nums) # 利用......

Arduion + LCD1062 + 超声波传感器


闲着无聊,玩起了Arduino!想弄一个note用来,有人和无人时显示不同的东西,尝试了红外和光敏都因传感器问题而放弃,最后用上了超声波,只能说精度一般! 接线 主要讲LCD1062 4位接法吧! 超声波 针脚 端口 TrigPin 12 EchoPin 10 代码 //1602采用标准的16脚接口,其中: //第1脚:VSS为地电源 //第2脚:VDD接5V正电源 //第3脚:V0为液晶显示器对比度调整端......

Coin Change | Dynamic Programming


You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. You may assume that you have an infinite number of each kind of coin. https://leetco......

Fibonacci Number | DpTable | Violent Hacking


The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. https://leetcode.com/problems/fibonacci-number/ Solution Violent Hacking / DP Table Code Violent Hacking O(2^n) submit code class Solution: def fib(self, n: int) -> int: ......

Move Zeroes


Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of the array. https://leetcode.com/problems/move-zeroes/ Solution Double Pointer / Fast And Slow Pointer Same with https://www.emperinter.info/2022/03/15/remove-duplicates-from-sorted-list/ we need......

Remove Element


Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The relative order of the elements may be changed. Since it is impossible to change the length of the array in some languages, you must instead have the result be placed in the first part of the array nums. More formally, if there are k elements after removing the duplicates, then the fir......


微信公众号

👉 NewsLetter ❤️ 邮箱订阅 👈

优惠码


阿里云国际版20美元
Vultr10美元
搬瓦工 | Bandwagon应该有折扣吧?
域名 | namesiloemperinter(1美元)