FastPrepTest the Hypothesis
Problems/Test the Hypothesis

Test the Hypothesis

Point72 logoPoint72● MediumOA
QuestionFunctionExamples

Problem statement

Given two arrays and a confidence level, determine whether the means of these series are significantly different using a two-tailed t-test. Additionally, output the magnitude by which the hypothesis passes or fails.

The magnitude is defined as the minimum absolute difference between the computed t-statistic and the t-statistic at the confidence level at the two tails.

Return an array with two values. The first element is "Yes" if the means are significantly different, or "No" if they are not. The second element is the magnitude rounded to 2 decimals.

Return both values as strings, with the magnitude formatted to exactly two decimal places.

Function signature

Complete the function testHypothesis with the following parameters:

ParameterTypeDescription
nintthe number of data points
x[n]floatan array of data points
y[n]floatanother array of data points
confidence_levelfloatthe confidence level to test the hypothesis

Function

testHypothesis(n: int, x: float[], y: float[], confidence_level: float) → String[]

Examples

Example 1

n = 4x = [4.461, 7.757, 17.317, 4.151]y = [8.911, 12.68, -10.593, 17.048]confidence_level = 0.95return = ["No", "2.47"]

Performing a t-test at the 95% confidence level shows that the means are not significantly different, and the magnitude by which the null hypothesis passes is 2.47.

Example 2

n = 10x = [0.878, 2.817, 0.121, -0.945, -0.055, -1.456, 0.35, -1.478, -1.687, -1.889]y = [1.142, -0.492, -0.988, -0.729, -0.846, -0.157, 0.5, 1.188, -1.075, -0.189]confidence_level = 0.95return = ["No", "1.82"]

Performing a t-test at the 95% confidence level shows that the means are not significantly different, and the magnitude by which the null hypothesis passes is 1.82.

More Point72 problems

  • Best Time to Buy and Sell Stock IIPHONE SCREEN · Seen Aug 2026
  • Find Minimum in a Rotated Sorted ArrayPHONE SCREEN · Seen Aug 2026
  • Maximize Array Beauty After DeletionsOA · Seen Aug 2026
All Point72 interview questionsSee Point72 hiring insights
Saved
class Solution {
    public String[] testHypothesis(int n, float[] x, float[] y, float confidence_level) {
      // write your code here
    }

}
Checking account…