FastPrepFind the Most Available Games
Problems/Find the Most Available Games

Find the Most Available Games

Discord logoDiscord● EasyFULLTIMEONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The source defines availability as the number of platforms carrying a game and supplies a sample catalog, but it does not specify ties, output order, empty input, or duplicate platform entries. The judged core task matches the visible source at about 90%.

Given parallel arrays gameNames and platforms, return the names of the games available on the greatest number of platforms. The array platforms[i] lists the platforms carrying gameNames[i].

For this exercise, assume each game's platform list contains unique values. Return every game tied for the maximum platform count in original input order. If gameNames is empty, return an empty array.

Function

mostAvailableGames(gameNames: String[], platforms: String[][]) → String[]

Examples

Example 1

gameNames = ["Cyber Quest","Battle Arena","Sky Adventure","Mystery World","Speed Racer"]platforms = [["playstation","xbox"],["pc"],["playstation"],["xbox","pc"],["pc","playstation"]]return = ["Cyber Quest","Mystery World","Speed Racer"]

The maximum platform count is 2. The games at indices 0, 3, and 4 each have two platforms and are returned in input order.

Example 2

gameNames = ["A","B","C"]platforms = [["pc"],["pc","xbox","switch"],["xbox","switch"]]return = ["B"]

B is carried on three platforms, more than either other game.

Constraints

  • 0 <= gameNames.length <= 10000.
  • platforms.length == gameNames.length.
  • 1 <= platforms[i].length <= 10.
  • Every platform name is non-empty and appears at most once for a game.

More Discord problems

  • Find a Game's GenreONSITE INTERVIEW · Seen Apr 2026
  • Find Games by Platform CountONSITE INTERVIEW · Seen Apr 2026
  • List Games by GenreONSITE INTERVIEW · Seen Apr 2026
All Discord interview questionsSee Discord hiring insights
Saved
public String[] mostAvailableGames(String[] gameNames, String[][] platforms) {
  // write your code here
}
Checking account…