FastPrepCount Equilibrium Indices
Problems/Count Equilibrium Indices

Count Equilibrium Indices

Expedia logoExpedia● EasyNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks for the number of equilibrium points. That counting request takes priority over a general reference about finding an index. We chose the limits and what happens with empty input. Our version is about 95% the same as the reported question.

An index i is an equilibrium index when the sum of all values strictly before it equals the sum of all values strictly after it. Do not include values[i] in either sum.

Return the total number of equilibrium indices in values. Count every qualifying index; do not return only the first index. An empty side has sum zero, so a single-element array always has one equilibrium index. An empty array has none.

Function

countEquilibriumIndices(values: int[]) → int

Examples

Example 1

values = [1,3,5,2,2]return = 1

Only index 2 qualifies: the left sum is 1+3=4 and the right sum is 2+2=4.

Example 2

values = [0,0,0]return = 3

At indices 0, 1 and 2, both side sums are zero. All three indices must be counted.

Example 3

values = []return = 0

There are no indices to count.

Constraints

  • 0 <= values.length <= 500.
  • -10000 <= values[i] <= 10000.

More Expedia Onsite Interview questions

  • Scramble StringONSITE INTERVIEW · Seen Sep 2026
  • Smallest Sufficient TeamONSITE INTERVIEW · Seen Sep 2026
  • Check Anagram Pairs Index by IndexONSITE INTERVIEW · Seen Oct 2025
  • Fresh Oranges Left After Rotting StopsONSITE INTERVIEW · Seen Oct 2025
  • Longest Increasing SubsequenceONSITE INTERVIEW · Seen Oct 2025
  • Lowest Common Ancestor with Repeated and Missing ValuesONSITE INTERVIEW · Seen Oct 2025
  • Shortest Substring with Exactly K OnesONSITE INTERVIEW · Seen Oct 2025
  • Middle Element of a Linked ListONSITE INTERVIEW · Seen Nov 2024
  • Minimum in a Rotated Sorted ArrayONSITE INTERVIEW · Seen Sep 2024
  • Mirror Image Binary TreesONSITE INTERVIEW · Seen Sep 2024

Similar questions at other companies

  • Roll a Weighted DieLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Advertisement Click Range SumsGoogle · ONSITE INTERVIEWGoogle interview questions
  • Calculate Server Shutdown PenaltyStripe · PHONE SCREEN · ONSITE INTERVIEWStripe interview questions
  • Find Pivot IndexMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Product of Array Except SelfWalmart Labs · ONSITE INTERVIEW
  • Subarrays Whose Sum Is a Power of TwoKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Maximize Compatible Car RidersUber Freight · PHONE SCREEN · ONSITE INTERVIEWUber Freight interview questions
  • Count Subarrays with Sum KMakeMyTrip.com · ONSITE INTERVIEWMakeMyTrip.com interview questions
  • Product Of Array Except SelfInfosys · ONSITE INTERVIEWInfosys interview questions
  • Maximum Subarray Sum with Length at Most KOracle · ONSITE INTERVIEWOracle interview questions

Interview reports that mention this question

  • Expedia New Grad SDE Earlier Loops: 5 Experiences (Part 2 of 3)

Expedia interview experiences

  • Expedia Intern Final Round in 2021: 28 Experiences (Part 4 of 6)
  • Expedia Intern Finals Before 2020: 14 Experiences (Part 6 of 6)
  • Expedia Intern Final Round in 2020: 24 Experiences (Part 5 of 6)
  • Expedia Intern Final Round in 2022: 15 Experiences (Part 3 of 6)
  • Expedia Intern Final Round in 2023: 17 Experiences (Part 2 of 6)
All Expedia interview questionsSee Expedia hiring insights
Saved
class Solution {
    public int countEquilibriumIndices(int[] values) {
        // Write your code here.
    }

}
Checking account…