FastPrepFind Games by Platform Count
Problems/Find Games by Platform Count

Find Games by Platform Count

Discord logoDiscord● EasyFULLTIMEONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The source asks for games available on an exact number of platforms and supplies a sample catalog, but it does not specify output order, no-match behavior, or duplicate platform entries. The judged core task matches the visible source at about 92%.

Given parallel arrays gameNames and platforms plus numberOfPlatforms, return every game available on exactly that many platforms. The array platforms[i] lists the platforms carrying gameNames[i].

For this exercise, assume each game's platform list contains unique values. Return matching game names in original input order. If no game has exactly numberOfPlatforms platforms, return an empty array.

Function

gamesByPlatformCount(gameNames: String[], platforms: String[][], numberOfPlatforms: int) → String[]

Examples

Example 1

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

The games at indices 0, 3, and 4 are each available on exactly 2 platforms.

Example 2

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

No game is available on exactly 3 platforms.

Constraints

  • 0 <= gameNames.length <= 10000.
  • platforms.length == gameNames.length.
  • 1 <= platforms[i].length <= 10.
  • 1 <= numberOfPlatforms <= 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 the Most Available GamesONSITE INTERVIEW · Seen Apr 2026
  • List Games by GenreONSITE INTERVIEW · Seen Apr 2026
All Discord interview questionsSee Discord hiring insights
Saved
public String[] gamesByPlatformCount(String[] gameNames, String[][] platforms, int numberOfPlatforms) {
  // write your code here
}
Checking account…