FastPrepUnique Unordered Dice Outcomes
Problems/Unique Unordered Dice Outcomes

Unique Unordered Dice Outcomes

Microsoft logoMicrosoft● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A Microsoft Data & Applied Scientist internship report asks for all outcomes without duplicates when rolling a k-sided die n times, where rolls in a different order count as the same. It has a DP follow-up. We chose the face labels, the order of the outcomes, what zero rolls gives, the function signature and the limits.

A die has faces labeled from 1 through faces and is rolled rolls times. Return every distinct outcome when roll order does not matter.

Represent each outcome as a nondecreasing array of face values. Return all outcomes in lexicographic order. Repeated face values are allowed. When rolls = 0, return one empty outcome.

Function

unorderedDiceOutcomes(faces: int, rolls: int) → int[][]

Examples

Example 1

faces = 3rolls = 2return = [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]

Each pair is nondecreasing, so order-equivalent results such as [1,2] and [2,1] appear only once.

Example 2

faces = 2rolls = 0return = [[]]

There is exactly one way to make zero rolls: the empty outcome.

Constraints

  • 1 <= faces <= 15
  • 0 <= rolls <= 10
  • The number of returned outcomes is at most 100000

More Microsoft Onsite Interview questions

  • Bad Request AlertsONSITE INTERVIEW · Seen Nov 2026
  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2026
  • Valid ParenthesesONSITE INTERVIEW · Seen Nov 2026
  • Count a User's Actions in an Event LogONSITE INTERVIEW · Seen Nov 2026
  • Smallest Batch Size Within a Step LimitONSITE INTERVIEW · Seen Nov 2026
  • Count Subarrays with Equal Even and Odd CountsONSITE INTERVIEW · Seen Nov 2026
  • Minimum Time to Rot All OrangesONSITE INTERVIEW · Seen Nov 2026
  • Coin ChangeONSITE INTERVIEW · Seen Oct 2026
  • Daily USD Totals with Effective-Dated Exchange RatesONSITE INTERVIEW · Seen Oct 2026
  • Number Words to Digits in Any LanguageONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Count Complete Tic-Tac-Toe GamesDecagon · PHONE SCREEN · ONSITE INTERVIEWDecagon interview questions
  • Enumerate Right-and-Down Matrix PathsOracle · ONSITE INTERVIEWOracle interview questions
  • Beautiful ArrangementMathWorks · ONSITE INTERVIEWMathWorks interview questions
  • First Valid Word SegmentationAmazon · ONSITE INTERVIEW
  • Generate One-Two Strings with Sum NGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Distinct Palindrome PartitionsMorgan Stanley · ONSITE INTERVIEWMorgan Stanley interview questions
  • Find a Subset of Exactly K Elements with a Target SumJP Morgan Chase · ONSITE INTERVIEWJP Morgan Chase interview questions
  • Count and Score Distinct Hat AssignmentsRoblox · ONSITE INTERVIEWRoblox interview questions
  • Partition a Card Deck into FifteensMeta · ONSITE INTERVIEWMeta interview questions
  • Maximum Currency Conversion Along a Simple PathRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions

Interview reports that mention this question

  • Microsoft AI/ML Intern Interviews: 114 Experiences (Part 1 of 2)

Microsoft interview experiences

  • Microsoft OA Questions, October 2026: 4 Experiences
  • Microsoft Experienced SWE Phone Screen: 1 Experience
  • Microsoft Explore and Student SWE: 12 Experiences (Part 6 of 6)
  • Microsoft SWE Intern, Early 2025: 41 Experiences (Part 5 of 6)
  • Microsoft SWE Intern, Mid 2025: 42 Experiences (Part 4 of 6)
All Microsoft interview questionsSee Microsoft hiring insights
Saved
class Solution {
    public int[][] unorderedDiceOutcomes(int faces, int rolls) {
      // Write your code here.
    }

}
Checking account…