leetcode-398-隨機數索引-C語言

/* * 算法思想: * 蓄水池抽樣算法,遍歷整個數組,根據蓄水池抽樣算法,決定當前元素的捨棄或者保留。 * */ typedef struct { int *arr; int len; } Solution; Solution* solutionCreate(int* nums, int numsSize) { int i; Solution* ob
相關文章
相關標籤/搜索