FastPrepFactor Combinations
Problems/Factor Combinations

Factor Combinations

LinkedIn logoLinkedIn● MediumINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand LinkedIn phone screen report for an intern role only described this as a backtracking or DFS question, like one on a practice site, about factorials. We matched it to the task of listing every way to write a number as a product of factors. We chose the input limits, leaving out the trivial factor, and the output order. Our version is about 78% the same as the reported question.

Special thanks: Special thanks to our MVP Rachel~ 💜

Given an integer n, return every unique combination of integers greater than 1 whose product is n.

Do not include the one-element combination [n]. Within each combination, factors must be in nondecreasing order. Return all combinations in lexicographic order so that the output is deterministic.

Function

getFactors(n: int) → int[][]

Examples

Example 1

n = 12return = [[2,2,3],[2,6],[3,4]]

The three nontrivial nondecreasing factorizations of 12 are 2 * 2 * 3, 2 * 6, and 3 * 4.

Example 2

n = 16return = [[2,2,2,2],[2,2,4],[2,8],[4,4]]

Nondecreasing order removes permutations such as [8, 2].

Example 3

n = 37return = []

37 is prime, so it has no nontrivial factor combination.

Constraints

  • 2 <= n <= 10000000
  • Every returned factor is greater than 1 and less than n.
  • The total number of valid combinations fits comfortably in memory.

More LinkedIn Phone Screen questions

  • Total Years of Work ExperiencePHONE SCREEN · Seen Nov 2026
  • Sum an Arbitrary-Dimensional ArrayPHONE SCREEN · Seen Oct 2026
  • Known Words Matching Phone DigitsPHONE SCREEN · Seen Oct 2026
  • Inverse-Depth Nested List SumPHONE SCREEN · Seen Oct 2026
  • Valid Number with ExponentsPHONE SCREEN · Seen Oct 2026
  • Maximum Product of a Contiguous SubarrayPHONE SCREEN · Seen Oct 2026
  • Maximum Sum of a Contiguous SubarrayPHONE SCREEN · Seen Oct 2026
  • Sort a Quadratic-Transformed ArrayPHONE SCREEN · Seen Oct 2026
  • Constant-Time Minimum StackPHONE SCREEN · Seen Oct 2026
  • Randomized String MultisetPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Factor CombinationsBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Binary Tree Target-Sum PathsByteDance · PHONE SCREENByteDance interview questions
  • Count Prefix Paths in a Character GraphGoogle · PHONE SCREENGoogle interview questions
  • Word SearchCognitiv · PHONE SCREEN
  • Unit Conversion IIApple · PHONE SCREENApple interview questions
  • Frog Position After T SecondsInMobi · PHONE SCREENInMobi interview questions
  • Count Pairs of Nodes That Cannot Reach Each OtherAdobe · PHONE SCREENAdobe interview questions
  • Polydivisible Pandigital NumbersHudson River Trading · PHONE SCREENHudson River Trading interview questions
  • Word SearchWhatNot · PHONE SCREENWhatNot interview questions
  • Directional Tiles: Find a Valid Reconfiguration PathDuolingo · PHONE SCREENDuolingo interview questions

Interview reports that mention this question

  • Google, Datadog, LinkedIn SWE Intern Onsites: 1 Experience

LinkedIn interview experiences

  • LinkedIn Staff AI Engineer Phone Screens: 1 Experience
  • LinkedIn Experienced MLE Onsite: 1 Experience
  • LinkedIn Coding with AI Interview: 4 Experiences
  • LinkedIn Experienced Infrastructure SWE Onsite: 1 Experience
All LinkedIn interview questionsSee LinkedIn hiring insights
Saved
class Solution {
    public int[][] getFactors(int n) {
      // Write your code here.
    }
}
Checking account…