PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Arista

Find missing value in sorted consecutive array

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of array properties and algorithmic complexity, specifically detecting a single missing element in a sorted consecutive sequence within the Coding & Algorithms category.

  • easy
  • Arista
  • Coding & Algorithms
  • Software Engineer

Find missing value in sorted consecutive array

Company: Arista

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

Given a sorted array `nums` of **distinct integers**. The numbers are supposed to form a consecutive sequence starting from some unknown integer `start`: - If nothing is missing, the sequence would be: `start, start+1, start+2, ..., start+n-1` where `n = len(nums)`. - But **at most one** number from this sequence may be missing in `nums`. Return the missing number if one exists; otherwise return `null` (or `-1`, but be consistent). **Requirements** - Time complexity must be **O(log n)**. - Space complexity must be **O(1)**. **Examples** - `nums = [4,5,6,8,9]` → missing is `7` - `nums = [-3,-2,-1,0,1]` → no missing → return `null` - `nums = [10,11,12,13,15]` → missing is `14` **Notes** - `start` can be any integer (including negative). - `nums` is already sorted ascending and contains no duplicates.

Quick Answer: This question evaluates understanding of array properties and algorithmic complexity, specifically detecting a single missing element in a sorted consecutive sequence within the Coding & Algorithms category.

Related Interview Questions

  • Remove Target Values from a Linked List - Arista (easy)
  • Solve palindrome and missing-number variants - Arista (easy)
Arista logo
Arista
Oct 4, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
3
0

Given a sorted array nums of distinct integers. The numbers are supposed to form a consecutive sequence starting from some unknown integer start:

  • If nothing is missing, the sequence would be: start, start+1, start+2, ..., start+n-1 where n = len(nums) .
  • But at most one number from this sequence may be missing in nums .

Return the missing number if one exists; otherwise return null (or -1, but be consistent).

Requirements

  • Time complexity must be O(log n) .
  • Space complexity must be O(1) .

Examples

  • nums = [4,5,6,8,9] → missing is 7
  • nums = [-3,-2,-1,0,1] → no missing → return null
  • nums = [10,11,12,13,15] → missing is 14

Notes

  • start can be any integer (including negative).
  • nums is already sorted ascending and contains no duplicates.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Arista•More Software Engineer•Arista Software Engineer•Arista Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ 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.