Determine Dice Outcomes (For L4 :)

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.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: