The Top-P (Nucleus) Sampling problem involves selecting the top words with cumulative probability P. **Example:** Given a list of words and P=0.5, select the top words. **Constraints:** The input will be a list of words and a P parameter.
Test Cases
Test Case 1
Input:
["hello", "world", "apple"], 0.5Expected:
["hello"]Test Case 2
Input:
["dog", "cat", "mouse"], 0.3Expected:
["dog"]+ 3 hidden test cases