As reported: Oracle Software Engineer (ERP team), round 1, Mar 2025 — given an array of strings, return those whose frequency is greater than a target; followed by the k-th largest element, Java questions and SQL.
Given an array of strings words and an integer target, return every distinct string that appears more than target times. List them in the order of their first appearance in words.
Example 1
words = ["apple","kiwi","apple","fig","kiwi","apple"], target = 1
Output: ["apple","kiwi"]
Example 2
words = ["a","b","c"], target = 1
Output: []
Constraints: 1 ≤ words.length ≤ 10^5; 1 ≤ words[i].length ≤ 10, English letters (case-sensitive); 0 ≤ target ≤ 10^5.
Code runner format: one JSON value per line — words, then target. Implement frequentStrings(words, target); the harness prints the list.
Clarifications
- "More than" is strict: a string that appears exactly
targettimes is not returned.