PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/LinkedIn

Find index with positive suffix sums

Last updated: Mar 29, 2026

Quick Overview

This question evaluates array manipulation and algorithmic problem-solving skills, focusing on reasoning about cumulative (suffix) sums and time-complexity analysis. Commonly asked in the Coding & Algorithms domain because it probes efficiency and optimization over naive approaches, it targets practical, implementation-level understanding rather than purely conceptual theory.

  • medium
  • LinkedIn
  • Coding & Algorithms
  • Data Scientist

Find index with positive suffix sums

Company: LinkedIn

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Given an unsorted integer array \(A\), find an index \(i\) such that every cumulative sum starting from \(i\) to the end of the array is strictly positive: - \(A[i] > 0\) - \(A[i] + A[i+1] > 0\) - \(A[i] + A[i+1] + A[i+2] > 0\) - ... - \(\sum_{k=i}^{n-1} A[k] > 0\) Return any valid index. If no such index exists, return \(-1\). First describe a baseline solution, then optimize it. Aim for better than \(O(n^2)\) time.

Quick Answer: This question evaluates array manipulation and algorithmic problem-solving skills, focusing on reasoning about cumulative (suffix) sums and time-complexity analysis. Commonly asked in the Coding & Algorithms domain because it probes efficiency and optimization over naive approaches, it targets practical, implementation-level understanding rather than purely conceptual theory.

Related Interview Questions

  • Count Trips From Vehicle Logs - LinkedIn (easy)
  • Design O(1) Randomized Multiset - LinkedIn (easy)
  • Process Mutable Matrix Sum Queries - LinkedIn (medium)
  • Design a Randomized Multiset - LinkedIn (medium)
  • Can You Place N Objects? - LinkedIn (medium)
LinkedIn logo
LinkedIn
Feb 19, 2026, 12:00 AM
Data Scientist
Technical Screen
Coding & Algorithms
3
0
Loading...

Given an unsorted integer array AAA, find an index iii such that every cumulative sum starting from iii to the end of the array is strictly positive:

  • A[i]>0A[i] > 0A[i]>0
  • A[i]+A[i+1]>0A[i] + A[i+1] > 0A[i]+A[i+1]>0
  • A[i]+A[i+1]+A[i+2]>0A[i] + A[i+1] + A[i+2] > 0A[i]+A[i+1]+A[i+2]>0
  • ...
  • ∑k=in−1A[k]>0\sum_{k=i}^{n-1} A[k] > 0∑k=in−1​A[k]>0

Return any valid index. If no such index exists, return −1-1−1.

First describe a baseline solution, then optimize it. Aim for better than O(n2)O(n^2)O(n2) time.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More LinkedIn•More Data Scientist•LinkedIn Data Scientist•LinkedIn Coding & Algorithms•Data Scientist Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.