汉诺塔问题(递归)

博客地址:https://www.cnblogs.com/zylyehuo/ # _*_coding:utf-8_*_ def hanoi(n, a, b, c): if n > 0: hanoi(n - 1, a, c, b) print("moving from %s to %s" % (a,

顺序查找(线性查找)

博客地址:https://www.cnblogs.com/zylyehuo/ 时间复杂度:O(n) # _*_coding:utf-8_*_ def linear_search(li, val): for ind, v in enumerate(li): if v == val: return in

贪心算法--拼接最大数字问题

博客地址:https://www.cnblogs.com/zylyehuo/ # -*- coding: utf-8 -*- from functools import cmp_to_key def xy_cmp(x, y): if x + y < y + x: return 1 # 表示 x>y

贪心算法--活动选择问题

博客地址:https://www.cnblogs.com/zylyehuo/ # -*- coding: utf-8 -*- def activity_selection(a): res = [a[0]] for i in range(1, len(a)): if a[i][0] >= res[-1

函数的作用域和匿名函数、闭包、回调

一、匿名函数: 1、filter函数,可以过滤出列表中大于3的数据,但是使用都需要提前定义一个函数,有没有更加简便的方式呢? def f(o): # 过滤器 if o>3: print(o) list(filter(f,[3,1,5,9,7,10])) 运行截图: 2、匿名函数(lambda后面是空

我的第一个项目(八):(解决问题)图片资源无法加载(Error: Cannot find module "../../xxx" )

好家伙,问题一堆 先开一个测试页模拟游戏模块的运行 原先的图片初始化方法失效了,(vue里面自然是用不了这种方法的) function createImage(src) { let img; if (typeof src "string") { img = new Image(); img.src

VBA 对象数组排序算法分享

Function SrotObjectByProperty(objsToSort As Variant, PropertyName As String, Optional 降序 As Boolean = True) If IsEmpty(objsToSort) Then Exit Function

[转帖]acme How to issue a cert

https://github.com/acmesh-official/acme.sh/wiki/How-to-issue-a-cert 1. Single domain: 1) Webroot mode: If you already have a web server running, you s

[转帖]Nginx中的Rewrite的重定向配置与实践

https://www.cnblogs.com/tugenhua0707/p/10798762.html 阅读目录 一:理解地址重写 与 地址转发的含义。 二:理解 Rewrite指令 使用 三:理解if指令 四:理解防盗链及nginx配置 简介:Rewrite是Nginx服务器提供的一个重要的功能

[转帖]Bash脚本编程学习笔记11:信号捕捉

首先我们先来看一段代码。 #!/bin/bash declare -i uphosts=0 declare -i downhosts=0 for i in 192.168.152.{98..102}; do if ping -W 2 -c 1 $i &>/dev/null; then echo "$

[转帖]awk(三) 列运算

https://www.jianshu.com/p/b46f783832e3 1. 求每一行中指定列的最大/小值 awk '{m=0;for(x=5;x<=NF;x++)if($x>m) {m=$x};print m}' input.file # 求第5列到最后一列中每行的最大值 awk '{m=0

[转帖]【shell语法 | 01】基础练习

https://www.cnblogs.com/sunbines/p/14587095.html 目录 利用判断符号[ ] 循环体 正文 回到顶部 利用判断符号[ ] [ str ] : str 字符串存在为真 1 [root@localhost ~]# if [ ]; then echo 'tru

[转帖]技术派-关于最佳线程数的计算的准确理解

Venkat Subramaniam 博士在《Programming Concurrency on the JVM》中提到关于最优线程数的计算: The minimum number of threads is equal to the number of available cores. If a

[转帖]Python基础之判断和循环(三)

https://www.jianshu.com/p/5a7552821c63 一、判断 关于判断,跟字面意思一样,就是判断某一个时刻应不应该做某件事; 语法: if 判断条件: 执行语句…… else: 执行语句…… 判断条件: <:小于 >:大于 ==:等于 !=:不等于 >=:大于等于 <=:小

[转帖]Linux中awk命令正确的求最大值、最小值、平均值、总和

`https://blog.csdn.net/fireblue1990/article/details/51622416` test.txt文件内容: 9 11 35 21 42 118 求最大值: awk 'BEGIN {max = 0} {if ($1+0 > max+0) max=$1} EN

[转帖]expect 实现 ssh免密登录的脚本

expect 实现 ssh免密登录的脚本 #!/bin/bash #Author:cosann #Version:0.2 #date:2022/7/27 #description:批量部署SSH免密登录脚本 E_ERROR=65 #传参检测 if [ $# -ne 1 ] then echo -e

[转帖]kingbase(人大金仓)的一些常用表操作语句

包括 1)创建表 2)删除表 3)加字段 4)字段换名 5)字段改类型 6)字段添加注释 7)修改字段为自增类型 8)增加主键 9)查看模式下的表 一、创建和删除表 DROP TABLE IF EXISTS "DZ_RAIN" CASCADE; CREATE TABLE "DZ_RAIN" ( "I

[转帖]Shell 判断文件或文件夹是否存在(不存在则创建)

目录 1. 文件夹不存在创建文件夹 2. 判断文件夹是否存在 3. 判断文件是否存在 4. 常用的文件比较符 1. 文件夹不存在创建文件夹 if [ ! -d "/data/" ];then mkdir /dataelse echo "文件夹已经存在"fi 2. 判断文件夹是否存在 if [ -d

TS不能将类型“any[]”分配给类型“never[]”

一、问题 在处理接口返回的数据,赋值给store中的数组时,报类型错误 data:{ cateList: [] } const getCateList = async () => { const res = await fetchCateList() as any if (res.code == 2

C# 跳过值班时间代码逻辑

/// /// 当前时间是否是值班时间 /// private bool IsDutyTime { get { var dutyTime = "23:00-07:00"; if (!string.IsNullOrEmpty(dutyTime)) { var