摘要:
在服务开发的时候,可能会遇到服务频繁启动或者频繁销毁的情况,需要分配和回收服务的资源;同时如果在服务关闭处理的不优雅的情况,还可能会丢失数据,因此服务设计的时候,需要考虑如何优雅的对服务进行启停。 package main import ( "fmt" "os" "os/signal" "sync" 阅读全文
摘要:
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 阅读全文
摘要:
func MulProduction() { concurrency := make(chan struct{}, 100) //控制最大协程数 wg := sync.WaitGroup{} defer close(concurrency) for id := 0; id < 100; id++ { 阅读全文
摘要:
package main import ( "fmt" "sync" ) type Producer struct { ID int DataStream chan int WaitGroup *sync.WaitGroup } func (p *Producer) Produce(concurre 阅读全文
摘要:
https://leetcode.cn/problems/k-th-smallest-in-lexicographical-order/solution/pythonjavajavascriptgo-di-gui-by-himymbe-5mq5/ func findKthNumber(n int, 阅读全文
摘要:
链接:https://www.nowcoder.com/questionTerminal/2b317e02f14247a49ffdbdba315459e7来源:牛客网 牛客项目发布项目版本时会有版本号,比如1.02.11,2.14.4等等 现在给你2个版本号version1和version2,请你比 阅读全文
摘要:
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 阅读全文
摘要:
https://leetcode.cn/problems/reorder-list/solution/zhong-pai-lian-biao-by-leetcode-solution/ /** * Definition for singly-linked list. * type ListNode 阅读全文
摘要:
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 阅读全文
摘要:
https://leetcode.cn/problems/generate-parentheses/solution/-by-1978-7-owhs/ /** * @name: 括号生成 * @param {int} n 括号的个数 * @return {*} */ func generatePar 阅读全文