FastPrepSort Ancestral Names
Problems/Sort Ancestral Names

Sort Ancestral Names

Roblox logoRoblox● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The candidate's original screenshots give the order of given names, the order of Roman numerals by value, examples, and limits. This version keeps those rules and returns a new array without changing the input. Our version is about 100% the same as the reported question.

Each entry in names has the form givenName romanNumeral, separated by one space. Sort the entries first by given name in ascending alphabetical order, then, for equal given names, by the Roman numeral’s numeric value in ascending order.

Return the original full strings in their sorted order, keeping each Roman spelling. For this exercise, assume the input array must remain unchanged.

Valid Roman numerals use I, V, X and L in standard notation: IV = 4, IX = 9 and XL = 40.

Function

sortRoman(names: String[]) → String[]

Examples

Example 1

names = ["Louis IX","Louis VIII"]return = ["Louis VIII","Louis IX"]

Both given names are Louis; 8 precedes 9.

Example 2

names = ["Philippe I","Philip II"]return = ["Philip II","Philippe I"]

Philip alphabetically precedes Philippe, regardless of numeral values.

Example 3

names = ["Steven XL","Steven XVI","David IX","Mary XV","Mary XIII","Mary XX"]return = ["David IX","Mary XIII","Mary XV","Mary XX","Steven XVI","Steven XL"]

Sort David, Mary, Steven, then each name’s numeric ordinal.

Constraints

  • 1 <= names.length <= 50; every full entry is distinct.
  • Every entry contains exactly one space between the given name and numeral.
  • 1 <= givenName.length <= 20; its first letter is uppercase A-Z and any following letters are lowercase a-z.
  • Every Roman numeral is valid standard notation for an integer from 1 through 50, inclusive.

More Roblox Online Assessment questions

  • Centered Block Placement QueriesOA · Seen Oct 2026
  • Robot Navigation Around LasersOA · Seen Oct 2026
  • Factory Batch Profit (Game Adaptation)OA · Seen Sep 2026
  • Nested Recipe Blocks (Game Adaptation)OA · Seen Sep 2026
  • Vehicle Builds for Required Terrain (Game Adaptation)OA · Seen Sep 2026
  • Track Received Byte RangesOA · Seen Sep 2026
  • Inventory Discount TrackerOA · Seen Sep 2026
  • Break a PalindromeOA · Seen Jun 2026
  • Count Pairs Differing in One DigitOA · Seen Oct 2025
  • Find Zero Cells in a 2×2 GridOA · Seen Oct 2025

Similar questions at other companies

  • Maximize Workday EarningsCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
  • Frequently Bought TogetherAmazon · OA
  • Aggregate Paginated Project Run RecordsReplit · OA
  • Product Record SearchWells Fargo · OAWells Fargo interview questions
  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions
  • Top N Longest SentencesDeloitte · OADeloitte interview questions
  • Sort Objects by a FieldZillow · OAZillow interview questions
  • Rank Word-Translation Hints from Sentence TranslationsDuolingo · PHONE SCREEN · ONSITE INTERVIEWDuolingo interview questions
  • Group AnagramsAmazon Web Services · ONSITE INTERVIEWAmazon Web Services interview questions

Interview reports that mention this question

  • Roblox OA: What It Tests (2026)
  • Roblox New Grad Early OA Tasks: 10 Experiences (Part 7 of 7)
  • Roblox New Grad HackerRank OA: 18 Experiences (Part 5 of 7)

Roblox interview experiences

  • Roblox New Grad Engineer Rounds: 13 Experiences (Part 6 of 7)
  • Roblox New Grad CodeSignal Finals: 23 Experiences (Part 4 of 7)
  • Roblox New Grad Games and BQ: 25 Experiences (Part 3 of 7)
All Roblox interview questionsSee Roblox hiring insights
Saved
class Solution {
    public String[] sortRoman(String[] names) {
        // write your code here
    }

}
Checking account…