FastPrepUniform Variables: Smaller Below Larger Squared
Problems/Uniform Variables: Smaller Below Larger Squared

Uniform Variables: Smaller Below Larger Squared

IMC Trading logoIMC Trading● EasyNEW GRADFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The reported probability event uses two independent uniform variables on [0,1]. This practice task matches that event at about 90% and generalizes the common upper bound. Independence is explicit in the newer report; the probability question belongs to the recorded video stage after the separate game OA.

Two random variables X and Y are independent and uniformly distributed on [0, upperBound]. Return the probability that min(X,Y) < max(X,Y)^2.

For this exercise, assume the common upper bound is supplied as an input, generalizing the [0,1] case in the first example. The inequality is strict. If upperBound = 0, both variables are zero and the event is false.

Complete uniformSquareProbability(upperBound). Answers within 1e-9 absolute error are accepted.

Function

uniformSquareProbability(upperBound: double) → double

Examples

Example 1

upperBound = 1.0return = 0.6666666666666666

In either half of the unit square, the favorable region has area 1/3. The total probability is 2/3; 1/3 is the complementary event.

Example 2

upperBound = 0.5return = 0.3333333333333333

On this smaller square, integrate twice the area under m^2 and divide by 0.5^2, giving 1/3.

Example 3

upperBound = 2.0return = 0.9166666666666666

For a maximum above one, every smaller value is below its square. The resulting probability is 1 - 1/12 = 11/12.

Example 4

upperBound = 0.0return = 0.0

Both variables equal zero, so 0 < 0 is false.

Constraints

  • For this exercise, assume upperBound = 0 or 0.000001 <= upperBound <= 1000.
  • The two variables have the same continuous uniform law when the upper bound is positive.
  • Return a double probability from 0 through 1.

More IMC Trading Phone Screen questions

  • Election District Budget Allocation AnalysisPHONE SCREEN · Seen Aug 2026
  • Combination Sum with Unlimited ReusePHONE SCREEN · Seen Dec 2025
  • Valid Range of a Three-Outcome Probability ParameterPHONE SCREEN · Seen Dec 2025
  • Expected Fishing CatchPHONE SCREEN · Seen Dec 2025
  • Count Routes Through a City GridPHONE SCREEN · Seen Nov 2024
  • Expected City Arrival and Return DaysPHONE SCREEN · Seen Nov 2024
  • Stationary City Population SharesPHONE SCREEN · Seen Nov 2024
  • Maximum Falling Path SumPHONE SCREEN · Seen Nov 2024
  • Trading Profit Percentage ChangePHONE SCREEN · Seen Feb 2024
  • Poker Suit Expected ProfitPHONE SCREEN · Seen Sep 2023

Similar questions at other companies

  • Parking Fee CalculatorBreeze · PHONE SCREEN
  • Merchant Payout Reserve CalculatorStripe · PHONE SCREENStripe interview questions
  • Sqrt(x)LinkedIn · PHONE SCREENLinkedIn interview questions
  • Automation Pipeline, Part 1: Single WorkerPlaid · PHONE SCREENPlaid interview questions
  • Subtract Two Large Number StringsStackAdapt · PHONE SCREENStackAdapt interview questions
  • Circular Primes Below a LimitAmazon · PHONE SCREEN
  • Palindrome NumberKotak Mahindra Bank · PHONE SCREENKotak Mahindra Bank interview questions
  • Streaming AverageXantium · PHONE SCREEN
  • Fair Coin from a Biased CoinAnthropic · PHONE SCREENAnthropic interview questions
  • Stack Formula InterpreterTypeSafe AI · PHONE SCREEN

IMC Trading interview experiences

  • IMC Trading OA: What It Tests (2026)
  • IMC Trading SWE OA and Video: 18 Experiences (Part 3 of 3)
  • IMC Trading SWE OA Questions: 22 Experiences (Part 2 of 3)
  • IMC SWE New Grad OA and Interviews: 58 Experiences (Part 1 of 3)
All IMC Trading interview questionsSee IMC Trading hiring insights
Saved
class Solution {
    public double uniformSquareProbability(double upperBound) {
        // Write your solution here.
    }
}
Checking account…