Sample Strings According to Rating Distribution (Softmax + CDF)

Problem overview from a real Pinterest interview:

You are given a list of strings and one real-valued rating for each string. Implement a sampler that returns strings with probability proportional to the softmax of their ratings.

Check more interview questions and experiences about Pinterest

Please log in to view interview details