Permutation Enumeration (Practice Reconstruction)
Updated
Problem statement
For this exercise, return every possible ordering of the distinct integers in nums. Each row must use every input value exactly once. Sort the rows in ascending lexicographic order: compare the first unequal values in two rows.
Keep the input array unchanged. For an empty input, return [[]], representing the one empty arrangement.
Function
allPermutations(nums: int[]) → int[][]Examples
Example 1
nums = [2,1]return = [[1,2],[2,1]]Both arrangements are returned in lexicographic order, regardless of the input order.
Example 2
nums = [3,1,2]return = [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]Three distinct values have 3!=6 arrangements.
Example 3
nums = []return = [[]]There is one way to arrange no values.
Constraints
0 <= nums.length <= 6.- The input values are distinct integers in
-100..100.
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
- 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
- Cat Route Budget Planning (Game Adaptation)OA · Seen Aug 2025
Similar questions at other companies
- Alternating Parity PermutationsGoldman Sachs · OAGoldman Sachs interview questions
- PermutationsAtlassian · OAAtlassian interview questions
- Generate Parameter CombinationsGecko Robotics · OA · PHONE SCREEN
- Count Legal Outfit CombinationsDuolingo · OADuolingo interview questions
- N-QueensIntuit · OAIntuit interview questions
- Optimal Account BalancingVirtu Financial · OAVirtu Financial interview questions
- Enumerate Valid Clock TimesMicrosoft · OAMicrosoft interview questions
- SubsetsTemu · PHONE SCREENTemu interview questions
- Unique Single-Use Sum CombinationsLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
- Bounded Combination Sum with Signed CandidatesConfluent · ONSITE INTERVIEWConfluent interview questions
Interview reports that mention this question
Roblox interview experiences
- Roblox New Grad Early OA Tasks: 10 Experiences (Part 7 of 7)
- 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)
- Roblox New Grad Coding Rounds: 23 Experiences (Part 2 of 7)