Month: March 2022

  • Count Primes

    Given an integer n, return the number of prime numbers that are strictly less than n.

  • MySql 主从复制配置

    最近又添加了几台服务器玩玩,现在有两个主机都在有数据库就想着能不能弄一个主从复制来作为数据的备份,这个数据有多重要就不需要我说了吧! 主节点配置 主机上的操作 主库在数据库配置文件添加如下,开启binlog log-bin server-id=1 重启数据库 导出主节点的所有表,并同步到子节点主机上 mysqldump -uroot -p密码 -A > /tmp/out.sql scp out.sql root@子节点主机IP:/tmp/ 数据库里的操作 登录数据库 mysql -uroot -p 创建同步账号/从节点要用连接导这个账号 CREATE USER ‘用户’@’从节点IP地址’ IDENTIFIED BY ‘密码’; grant replication slave, replication client on *.* to ‘用户’@’从节点IP地址’; flush privileges; 查看主节点状态,记住其中的File和Position,假设File为:emperinter.88888888,Position为:88888888, 从节点数据库配置启动要用。 show master status; 数据库用户更改密码 set password for 用户名@从节点IP地址 = password(‘新密码’); 从节点配置 主机上的操作 导入数据库…

  • 树莓派pico初体验

    最近买个屏幕发现了,树莓派pico这个小东西。价格比Arduino还便宜就买回来了一个玩玩,只能说还不多,现在感觉如果没有具体的项目需求好像功能都差不多,都可以用做一些简单的小项目。唯一目前体会到的是更大的存储容量并支持Cpython。

  • 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.

  • 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.

  • Arduion + LCD1062 + 超声波传感器

    闲着无聊,玩起了Arduino!想弄一个note用来,有人和无人时显示不同的东西,尝试了红外和光敏都因传感器问题而放弃,最后用上了超声波,只能说精度一般!

  • 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…

  • 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.

  • 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.

  • 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…