FastPrepFinite Weighted Outcome Expectation
Problems/Finite Weighted Outcome Expectation

Finite Weighted Outcome Expectation

Susquehanna International Group (SIG) logoSusquehanna International Group (SIG)● EasyFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: FastPrep estimates about 20% alignment with the brief report: dice and wheel expectation calculations are named, but their actual outcomes, rules and requested quantities were not preserved. This practice version authors a single finite weighted-outcome model and exact reduced-fraction output; it does not reconstruct the original assessment questions.

You run one random experiment with a fixed list of possible outcomes, like rolling a die or spinning a wheel. Find its expected value.

Your function gets two arrays of the same length, values and weights. Each index i is one entry. Its outcome is the integer values[i], and its weight is the positive integer weights[i]. An entry is picked with probability equal to its weight divided by the sum of all weights. Exactly one entry is picked. There are no repeated trials and no stopping rules.

Return the expected outcome as a string numerator/denominator in lowest terms. The denominator must be positive. If the result is zero, return 0/1. If the result is a whole number, the denominator is still 1. Do not round, and do not return a decimal approximation.

If the same value appears more than once, each copy is its own entry, so keep every entry's weight. The order of the arrays does not change the answer. All inputs satisfy the constraints.

Function

expectedValue(values: int[], weights: int[]) → String

Examples

Example 1

values = [1,2,3,4,5,6]weights = [1,1,1,1,1,1]return = "7/2"

The six faces are equally likely. Their mean is 21/6, which reduces to 7/2.

Example 2

values = [-2,4,10]weights = [1,2,1]return = "4/1"

The three entries are picked with probabilities 1/4, 2/4 and 1/4. The expected outcome is (-2+8+10)/4=4, so the answer is 4/1.

Example 3

values = [-3,2]weights = [2,3]return = "0/1"

The two entries add -6 and 6 to the weighted sum, so the expected outcome is 0. Written as a fraction in lowest terms, that is 0/1.

Constraints

  • 1 <= values.length = weights.length <= 256.
  • -1000000 <= values[i] <= 1000000.
  • 1 <= weights[i] <= 1000000.
  • Use signed 64-bit integers for the weighted sums. Before you reduce the fraction, the numerator's absolute value is at most 256 × 1012.

More Susquehanna International Group (SIG) Online Assessment questions

  • Centered Block Placement QueriesOA · Seen Dec 2026
  • Catch Fish with Reusable BaitsOA · Seen Nov 2026
  • Bold Play to Reach a GoalOA · Seen Nov 2026
  • Cats, Truth and Who Has MoreOA · Seen Nov 2026
  • Counting Cows by Their LegsOA · Seen Nov 2026
  • Enough Muffins for the LineOA · Seen Nov 2026
  • Expected Consecutive Pairs Among Chosen NumbersOA · Seen Nov 2026
  • Four-by-Four Boundary GridOA · Seen Nov 2026
  • Frog Paths Without Long RunsOA · Seen Nov 2026
  • Higher Roll, or Lose the SumOA · Seen Nov 2026

Similar questions at other companies

  • Summarize Taxi Drivers and RidesBoston Consulting Group · OABoston Consulting Group interview questions
  • Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Server InvestmentRippling · OARippling interview questions
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Identification Number Check DigitAbridge · OAAbridge interview questions
  • Count Substrings With Identical CharactersVirtu Financial · OAVirtu Financial interview questions
  • Next Pascal Row CoefficientIntuit · OAIntuit interview questions
  • Digit-Sum Sequence Join PointOpenAI · OAOpenAI interview questions
  • Minimum Testers to Find the Poisoned BottleWalleye Capital · OA

Susquehanna International Group (SIG) interview experiences

  • SIG Quant Researcher Experienced Hire Interviews: 11 Experiences
  • SIG Quant Research Intern Interviews: 60 Experiences
  • SIG Quant Researcher New Grad Interviews: 49 Experiences
  • SIG Quant Researcher Intern Interviews: 1 Experience
  • SIG Quant Second-Round Tech Screen: 1 Experience
All Susquehanna International Group (SIG) interview questionsSee Susquehanna International Group (SIG) hiring insights
Saved
class Solution {
    public String expectedValue(int[] values, int[] weights) {
        // write your code here
    }
}
Checking account…