FastPrepAverage of a Fixed-Size Array
Problems/Average of a Fixed-Size Array

Average of a Fixed-Size Array

Tesla logoTesla● EasyINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Tesla AI intern technical interview. The report keeps only the main task: find the average of a fixed-size array. Our version is about 85% the same as the reported question.

Given a non-empty fixed-size array of integers numbers, return its arithmetic mean.

The arithmetic mean is the sum of all values divided by the number of values.

Function

calculateAverage(numbers: int[]) → double

Examples

Example 1

numbers = [1,2,3,4]return = 2.5

The sum is 10, and 10 / 4 = 2.5.

Example 2

numbers = [7]return = 7.0

A single-element array has that element as its mean.

Example 3

numbers = [-5,0,5,10]return = 2.5

The values sum to 10, so the mean is 10 / 4 = 2.5.

Constraints

  • 1 <= numbers.length <= 10^5.
  • -10^9 <= numbers[i] <= 10^9.
  • The sum of all values fits in a signed 64-bit integer.

More Tesla Phone Screen questions

  • Flatten a Branched List into a Doubly Linked ListPHONE SCREEN · Seen Sep 2026
  • Reduce-Based Map and Filter PipelinePHONE SCREEN · Seen Sep 2026
  • Resilient Fake API ClientPHONE SCREEN · Seen Sep 2026
  • Merge JSON Array FieldsPHONE SCREEN · Seen Aug 2026
  • KV Store with RollbackPHONE SCREEN · Seen Apr 2026
  • Multi-Channel Valid ConvolutionPHONE SCREEN · Seen Oct 2024
  • Course Schedule FeasibilityPHONE SCREEN · Seen Aug 2024
  • Swap Even and Odd BitsPHONE SCREEN · Seen Mar 2023
  • Find the Intersection Node of Two Linked ListsPHONE SCREEN · Seen Oct 2022
  • Priority, Expiration, and LRU EvictionPHONE SCREEN · Seen Mar 2021

Similar questions at other companies

  • Merchant Payout Reserve CalculatorStripe · PHONE SCREENStripe interview questions
  • 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

Interview reports that mention this question

  • Tesla Intern Python Interview Prep Guide

Tesla interview experiences

  • Tesla Experienced Infrastructure SWE Interviews: 1 Experience
  • Tesla Older SWE Intern Reports: 14 Experiences (Part 4 of 4)
  • Tesla Embedded and SRE Intern Loops: 15 Experiences (Part 3 of 4)
  • Tesla SWE and Data Intern Rounds: 10 Experiences (Part 2 of 4)
  • 2017–2026 Tesla Intern OA / Interviews: 83 Experiences (Part 2 :)
All Tesla interview questionsSee Tesla hiring insights
Saved
class Solution {
    public double calculateAverage(int[] numbers) {
      // write your code here
    }
}
Checking account…