摘要:
题目链接:29. 两数相除 - 力扣(LeetCode) 解析: 快速乘 + 二分,快速乘和快速幂一个板子,只不过乘法变加法,最后看了眼题目解析,我觉得有个二分的地方说的很好,摘抄下来,供思考 long l = 0, r = 1000009; while (l < r) { long mid = l 阅读全文
摘要:
题目链接:33. 搜索旋转排序数组 - 力扣(LeetCode) 解析: 先二分找k 然后两边分别lowerbound就好了 class Solution { public: int search(vector<int>& nums, int target) { int n = nums.size( 阅读全文
摘要:
实现多进程,以及拿到每个进程return的返回值,并增加超时机制,如果进程超时,则立即kill import os import time from concurrent.futures import ProcessPoolExecutor, as_completed from multiproce 阅读全文