FastPrepPermutations with Indexed Inequalities
Problems/Permutations with Indexed Inequalities

Permutations with Indexed Inequalities

Intuit logoIntuit● MediumINTERNOA

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report explicitly writes a factor n in the nonspecial inequality. This version preserves it literally; one-based adjacency indexing, ordering, and finite output limits are practice assumptions; about 90% match.

Return all permutations p of the distinct integers in nums. For every one-based adjacency index i from 1 to n-1: if i occurs in special, require p[i-1] < p[i]; otherwise require p[i-1] > n * p[i]. The multiplier n is the length of nums. Both inequalities are strict.

Return permutations in ascending lexicographic order by their integer values. Return an empty matrix if none qualifies. The special values describe adjacency positions, not values in nums.

Function

validPermutations(nums: int[], special: int[]) → int[][]

Examples

Example 1

nums = [1,2,3]special = [1,2]return = [[1,2,3]]

All adjacency indices are special, so the permutation is increasing.

Example 2

nums = [1,2,3]special = []return = []

Without a special index, the literal factor n prevents a valid positive chain here.

Constraints

  • For this exercise, assume 1 <= nums.length <= 8, all values are distinct signed 32-bit integers, and special contains distinct values in [1,n-1].
  • For this exercise, assume at most 1000 permutations satisfy the rules. Compare n*p[i] in signed 64-bit arithmetic.

More Intuit Online Assessment questions

  • Employee Promotion OpportunitiesOA · Seen Oct 2026
  • Next Pascal Row CoefficientOA · Seen Oct 2026
  • Parse Router LogsOA · Seen Oct 2026
  • Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
  • Maximum Square-Free DivisorOA · Seen Oct 2026
  • Two Tribes from Taller-Person CountsOA · Seen Oct 2026
  • Shortest Path from an Encoded GraphOA · Seen Sep 2026
  • Oldest and Youngest EmployeesOA · Seen Sep 2026
  • Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
  • Submask Sum QueriesOA · Seen Sep 2026

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
  • Permutation Enumeration (Practice Reconstruction)Roblox · OARoblox interview questions
  • Optimal Account BalancingVirtu Financial · OAVirtu Financial interview questions
  • Enumerate Valid Clock TimesMicrosoft · OAMicrosoft interview questions
  • Largest Number Below N from Reusable DigitsByteDance · PHONE SCREENByteDance interview questions
  • SubsetsTemu · PHONE SCREENTemu interview questions
  • Unique Single-Use Sum CombinationsLinkedIn · ONSITE INTERVIEWLinkedIn interview questions

Interview reports that mention this question

  • Intuit OA: What It Tests (2026)

Intuit interview experiences

  • Intuit Software Engineering Intern - Full Stack OA Format
All Intuit interview questionsSee Intuit hiring insights
Saved
class Solution {
    public int[][] validPermutations(int[] nums, int[] special) {
        // Write your code here
    }
}
Checking account…