2024-08-24 02:12
요즘은 잘 안묻는 유명한 코딩 인터뷰 문제. An array is given as an iterator with .has_next() and .next() methods. E.g. # iterating the array iterator while data.has_next(): print(data.next()) where .has_next() returns True if there is a next element to read, otherwise False, and .next() yields the next array element if .has_next() is true. Write a function that randomly and fairly samples k elements from this array given as an iterator.
回覆
轉發

作者

Hey
brew.ai
粉絲
串文
80+

回覆

轉發

24小時粉絲增長

無資料

互動率

(讚 + 回覆 + 轉發) / 粉絲數
NaN%

回覆 (BETA)

最先回覆的內容
發文後用戶內容

© 2025 Threadser.net. 版權所有。

Threadser.net 與 Meta Platforms, Inc. 無關,未經其認可、贊助或特別批准。

Threadser.net 也不與 Meta 的"Threads" 產品存在任何關聯。