Search
⌘K

Leetcode 571. Find Median Given Frequency of Numbers

Given an array of frequencies where freq[i] is the count of value i (counts may be large), compute the median of the implicit multiset without expanding it; handle odd vs even total counts and return the middle value (or average of two middle values) efficiently using prefix sums or binary search on cumulative counts.

Asked at:

Amazon

Amazon


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early November, 2024

Amazon

Amazon

Junior

Find Median from Data Stream

Comments

Your account is free and you can post anonymously if you choose.