FastPrepFastPrep
Problem Brief

Determine Dice Outcomes (For L4 :)

FULLTIMEONSITE INTERVIEW

You are given two N-sided dice, P and Q, where each die has N integer values (not necessarily unique or standard).

When rolled, each side is equally likely to appear.

Given the values on each side of dice P and Q, determine:

  • The number of outcomes where P's roll is greater than Q's roll (i.e., P wins).
  • Follow up 1: The number of outcomes where Q wins.
  • Follow up 2: The number of outcomes where both rolls are equal (tie).
  • P and Q are always in non-decreasing sorted order.

    1Example 1

    Input
    P = [1, 2, 4], Q = [2, 2, 5]
    Output
    [-0, -0, -0]
    Explanation
    Hello - Example output is just a placeholder to let the system not complain about missing output :)
    public int[] determineDiceOutcomes(int[] P, int[] Q) {
      // write your code here
    }
    
    Input

    P

    [1, 2, 4]

    Q

    [2, 2, 5]

    Output

    [-0, -0, -0]

    Sign in to submit your solution.