praise and a list of critical words critique; no word appears in both.
Review reviews[i] is about the intern with ID ids[i], and every intern has exactly one review. Each word of a review found in praise gives the intern +3 points, each word found in critique takes away 1 point, and any other word changes nothing. A repeated word counts every time it appears.
Rank the interns by points from highest to lowest, breaking ties by the smaller ID first. Return the IDs of the first k interns in that order.praise=['neat', 'fast'], critique=['late', 'sloppy'], reviews=['neat and fast work', 'late again', 'fast but sloppy'], ids=[7, 3, 5], k=2 → [7, 5]
Intern 7 gets two words of praise: 3 + 3 = 6 points. Intern 3 gets one critical word: -1. Intern 5 gets one of each: 3 - 1 = 2. The top two are 7 and 5.
praise=['kind'], critique=['rude'], reviews=['kind', 'kind'], ids=[9, 4], k=1 → [4]
Both have 3 points; on a tie the smaller ID ranks higher, so it is 4.
praise=['clear'], critique=['vague'], reviews=['vague and vague again', 'nothing special'], ids=[12, 30], k=2 → [30, 12]
A word that appears twice counts twice: intern 12 ends with -2 and intern 30 with 0, so 30 comes first.
praise and critique are 1–100 lowercase English letters, and the lists share no wordreviews[i] is 1–100 characters: lowercase English letters with single spaces between wordspraise=['neat', 'fast'], critique=['late', 'sloppy'], reviews=['neat and fast work', 'late again', 'fast but sloppy'], ids=[7, 3, 5], k=2
[7, 5]
Run checks the first 3 tests in your browser. Submit checks all 84 tests on the server, hidden ones included.