Loading

摘要: 田忌赛马背后的算法决策 870. 优势洗牌 class Solution { public: vector<int> advantageCount(vector<int>& nums1, vector<int>& nums2) { int n = nums1.size(); priority_que 阅读全文
posted @ 2023-04-16 15:47 杨谖之 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 带权重的随机选择算法 528. 按权重随机选择 不使用二分法: class Solution { private: vector<int> preSum; int N = 0; public: Solution(vector<int>& w) { srand(time(0)); preSum.pus 阅读全文
posted @ 2023-04-16 11:01 杨谖之 阅读(56) 评论(0) 推荐(0) 编辑