FastPrepExpected Fishing Catch
Problems/Expected Fishing Catch

Expected Fishing Catch

IMC Trading logoIMC Trading● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an IMC Trading phone screen. The expected-catch goal is about 90% the same as the reported fishing question. The report gives no table of catch numbers, so the outcomes, probability weights, limits and examples are our choices. The later talk about a market quote and whether to accept it is only background. We do not grade any best spread that the report did not give.

A fishing trip can end in one of a fixed, finite list of outcomes. Outcome i brings in catches[i] fish. Its probability is weights[i] / sum(weights). The weights are integers that are zero or more, and their total is positive.

Return the expected number of fish caught on one trip. Two outcomes may have the same catch amount. Each of them still counts with its own weight. An outcome with zero weight adds nothing.

Complete expectedFishingCatch(catches, weights). It gets the outcome table as two arrays. Your answer is accepted when its absolute error is at most 1e-7 * max(1, abs(expected)). In other words, the tolerance is 1e-7, relative or absolute.

Function

expectedFishingCatch(catches: int[], weights: int[]) → double

Examples

Example 1

catches = [0,2,5]weights = [1,2,1]return = 2.25

Multiply each catch by its weight and add the results: 0+4+5=9. Divide by the total weight, 4, to get the answer 2.25.

Example 2

catches = [3]weights = [8]return = 3.0

The only possible catch is three fish, so its probability is one and the expectation is three.

Example 3

catches = [0,0]weights = [1,1]return = 0.0

Both outcomes catch zero fish, so the expected catch is zero.

Example 4

catches = [1,2]weights = [1,2]return = 1.6666666666666667

The expected catch is (1+4)/3=5/3. Return it with its fractional part, not rounded to a whole fish.

Constraints

  • Both arrays have the same length, from 1 through 100.
  • 0 <= catches[i], weights[i] <= 1000000, and at least one weight is positive.
  • Return the expected catch as a double. Do not round it to a whole fish.
  • The inputs are not modified.

More IMC Trading Phone Screen questions

  • Election District Budget Allocation AnalysisPHONE SCREEN · Seen Aug 2026
  • Uniform Variables: Smaller Below Larger SquaredPHONE SCREEN · Seen Mar 2026
  • Combination Sum with Unlimited ReusePHONE SCREEN · Seen Dec 2025
  • Valid Range of a Three-Outcome Probability ParameterPHONE 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 expectedFishingCatch(int[] catches, int[] weights) {
        // Write your solution here.
    }
}
Checking account…