摘要: package main import ( "fmt" "os" "os/signal" "syscall" "time" ) func main() { readCh := make(chan int, 100) //生产者写数据 go func() { for i := 0; i <= 10; 阅读全文
posted @ 2024-06-28 18:57 知道了呀~ 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 背景: 1、对于有就绪状态的服务来说,进程起来了并不等同于服务就绪了,该服务能否提供服务强依赖于就绪状态2、服务的运行状态不是由服务进程决定的,而是由外部的状态开关去动态配置(start\handle\stop)3、如果服务从启动到进入就绪状态,需要较长的时间,在这个期间频繁的下发启动命令,就可能重 阅读全文
posted @ 2023-08-23 20:14 知道了呀~ 阅读(17) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" ) func printLetter(ch chan bool, letter string, nextCh chan bool, done chan bool) { for i := 0; i < 5; i++ { <-ch fmt.Prin 阅读全文
posted @ 2023-08-19 17:27 知道了呀~ 阅读(82) 评论(0) 推荐(0) 编辑
摘要: func MulProduction() { concurrency := make(chan struct{}, 100) //控制最大协程数 wg := sync.WaitGroup{} defer close(concurrency) for id := 0; id < 100; id++ { 阅读全文
posted @ 2023-08-01 10:53 知道了呀~ 阅读(18) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "sync" ) type Producer struct { ID int DataStream chan int WaitGroup *sync.WaitGroup } func (p *Producer) Produce(concurre 阅读全文
posted @ 2023-08-01 10:34 知道了呀~ 阅读(25) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/k-th-smallest-in-lexicographical-order/solution/pythonjavajavascriptgo-di-gui-by-himymbe-5mq5/ func findKthNumber(n int, 阅读全文
posted @ 2022-08-18 18:36 知道了呀~ 阅读(83) 评论(0) 推荐(0) 编辑
摘要: 链接:https://www.nowcoder.com/questionTerminal/2b317e02f14247a49ffdbdba315459e7来源:牛客网 牛客项目发布项目版本时会有版本号,比如1.02.11,2.14.4等等 现在给你2个版本号version1和version2,请你比 阅读全文
posted @ 2022-07-15 15:59 知道了呀~ 阅读(148) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/split-array-into-fibonacci-sequence/solution/jiang-shu-zu-chai-fen-cheng-fei-bo-na-qi-ts6c/ func splitIntoFibonacci(str s 阅读全文
posted @ 2022-07-12 16:26 知道了呀~ 阅读(62) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/reorder-list/solution/zhong-pai-lian-biao-by-leetcode-solution/ /** * Definition for singly-linked list. * type ListNode 阅读全文
posted @ 2022-07-12 12:11 知道了呀~ 阅读(100) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/sqrtx/solution/x-de-ping-fang-gen-by-leetcode-solution/ //二分查找 某个数 func mySqrt(x int) int { l, r := 0, x ans := -1 for l 阅读全文
posted @ 2022-07-12 11:18 知道了呀~ 阅读(96) 评论(0) 推荐(0) 编辑