Workers Finishing One Job Together
Updated
Problem statement
A team of workers shares one job, such as building a wall or painting a fence. Worker i would finish the whole job alone in minutes[i] minutes. Each worker always works at the same steady speed, and when they work together on the job their work simply adds up.
All workers start at the same moment and work on the same single job. Return the number of minutes they need to finish it together.
Answers within 1e-6 of the exact value are accepted.
Function
timeTogether(minutes: int[]) → doubleExamples
Example 1
minutes = [60,30]return = 20.0The first worker builds one wall per hour, so alone they need 60 minutes. The second builds two walls per hour, so alone they need 30 minutes. Per minute they finish 1/60 + 1/30 = 3/60 = 1/20 of the wall together, so the wall is done after 20 minutes.
Example 2
minutes = [4,12]return = 3.0Per minute the two workers finish 1/4 + 1/12 = 4/12 = 1/3 of the job, so together they need 3 minutes.
Example 3
minutes = [2,3,6]return = 1.0Per minute the three workers finish 1/2 + 1/3 + 1/6 = 1 whole job, so together they need 1 minute.
Constraints
1 <= minutes.length <= 2 * 1041 <= minutes[i] <= 106
More Jane Street Phone Screen questions
- Maximum-Scoring Consecutive Tree LevelsPHONE SCREEN · Seen Nov 2026
- Tree Selection and VisibilityPHONE SCREEN · Seen Nov 2026
- Load/Store Arithmetic InterpreterPHONE SCREEN · Seen Oct 2026
- Instrument Stack Language JumpsPHONE SCREEN · Seen Oct 2026
- Run a Stack Language InterpreterPHONE SCREEN · Seen Oct 2026
- Positive-Integer Expression EvaluationPHONE SCREEN · Seen Oct 2026
- Add Two Integers Given as StringsPHONE SCREEN · Seen Sep 2026
- Angle Between Clock HandsPHONE SCREEN · Seen Jul 2026
- Route Length From Two CyclistsPHONE SCREEN · Seen Jul 2026
- Sort TradesPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
Similar questions at other companies
- Automation Pipeline, Part 1: Single WorkerPlaid · PHONE SCREENPlaid interview questions
- Employee Count Median, Mean and ModeClay · PHONE SCREEN
- Length of a Document Reached Through a Random TokenMercor · PHONE SCREENMercor interview questions
- Apply Affine Array TransformationsByteDance · PHONE SCREENByteDance interview questions
- Exponential Backoff DelaysWonderful · PHONE SCREEN
- One-Nearest-Neighbor Classification with Manhattan DistanceOpenAI · PHONE SCREENOpenAI interview questions
- Recover Document Hierarchy from IndentationReducto · PHONE SCREEN
- Average Grades per StudentHartford Financial Services · PHONE SCREENHartford Financial Services interview questions
- Through-Origin Linear RegressionMeta · PHONE SCREENMeta interview questions
- Latency Bucket CounterDatadog · OA · PHONE SCREENDatadog interview questions