FastPrepREST API: Highest International Students
Problems/REST API: Highest International Students

REST API: Highest International Students

Rippling logoRippling● EasyFULLTIMEOA
QuestionFunctionExamplesConstraints

Problem statement

Source note: The source uses a paginated HackerRank API and cuts off the lower schema and function signature. The judged version supplies the complete API records as input; the core city fallback and maximum-selection task matches the visible source at about 94%.

The original task retrieves every page from a global university API. For deterministic practice, all fetched records are supplied in universityRecords. Each row has exactly three fields:

  1. university: the university name
  2. city: the university city
  3. internationalStudents: a nonnegative decimal count that may contain comma separators

First consider records whose city exactly equals firstCity. If at least one exists, return the university name with the largest parsed international-student count. Otherwise, perform the same selection for secondCity.

If several universities in the selected city have the same maximum count, return the lexicographically smallest university name.

Function

highestInternationalStudents(firstCity: String, secondCity: String, universityRecords: String[][]) → String

Examples

Example 1

firstCity = "London"secondCity = "Boston"universityRecords = [["King's College London","London","15,075"],["University College London","London","21,500"],["Boston Tech","Boston","8,000"]]return = "University College London"

London has records, so Boston is not considered. 21,500 is larger than 15,075, so University College London is returned.

Example 2

firstCity = "Seattle"secondCity = "Boston"universityRecords = [["Beta University","Boston","12,000"],["Alpha University","Boston","12,000"],["Gamma College","Chicago","25,000"]]return = "Alpha University"

Seattle has no record, so the search falls back to Boston. The two Boston universities tie at 12,000, and Alpha University is lexicographically smaller.

Constraints

  • For this exercise, assume 1 <= universityRecords.length <= 100000.
  • For this exercise, assume every row has exactly three nonempty strings in the order [university, city, internationalStudents].
  • For this exercise, assume each parsed international-student count is between 0 and 10^9, inclusive.
  • For this exercise, assume at least one record matches firstCity or secondCity.
  • City matching is exact and case-sensitive.

More Rippling problems

  • Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dependency-Aware Task SchedulerPHONE SCREEN · Seen Nov 2026
  • Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
All Rippling interview questionsSee Rippling hiring insights
Saved
class Solution {
    public String highestInternationalStudents(String firstCity, String secondCity, String[][] universityRecords) {
        // Write your code here.
    }

}
Checking account…