PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates competencies in string processing, array manipulation, binary search, and algorithmic complexity analysis by asking a palindrome check and a missing-number problem that requires both O(n) and O(log n) reasoning, emphasizing edge-case handling and time/space complexity discussion.

  • easy
  • Arista
  • Coding & Algorithms
  • Software Engineer

Solve palindrome and missing-number variants

Company: Arista

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

You are asked to solve two coding problems and analyze the time and space complexity of each. 1. **Palindrome check** Given a string `s`, determine whether it reads the same forward and backward. Treat the empty string as a valid palindrome. If `s` is `null`, return `false`. 2. **Missing number with arbitrary start** Given a sorted array `nums` of distinct integers, the values should form a consecutive sequence with step size 1, but exactly one number is missing. The sequence does **not** necessarily start at 0. Examples: - `[4, 5, 6, 8, 9]` -> `7` - `[10, 11, 13]` -> `12` First describe an `O(n)` solution, then improve it to an `O(log n)` solution using binary search. For both problems, be prepared to explain your time and space complexity and discuss edge cases.

Quick Answer: This question evaluates competencies in string processing, array manipulation, binary search, and algorithmic complexity analysis by asking a palindrome check and a missing-number problem that requires both O(n) and O(log n) reasoning, emphasizing edge-case handling and time/space complexity discussion.

Palindrome Check

Return whether a string reads the same forward and backward; None returns false and empty string is valid.

Constraints

  • Input is a string or None

Examples

Input: ('racecar',)

Expected Output: True

Explanation: Odd palindrome.

Input: ('',)

Expected Output: True

Explanation: Empty string.

Input: (None,)

Expected Output: False

Explanation: Null input.

Input: ('abca',)

Expected Output: False

Explanation: Mismatch.

Hints

  1. Compare characters from both ends.

Missing Number with Arbitrary Start

Given sorted distinct integers from a consecutive sequence with one missing value, return the missing value.

Constraints

  • Exactly one number is missing from the represented consecutive sequence

Examples

Input: ([4, 5, 6, 8, 9],)

Expected Output: 7

Explanation: Missing in middle.

Input: ([10, 11, 13],)

Expected Output: 12

Explanation: Small example.

Input: ([1, 3],)

Expected Output: 2

Explanation: Missing second value.

Input: ([-3, -2, 0, 1],)

Expected Output: -1

Explanation: Negative start.

Hints

  1. For index i before the gap, nums[i] == nums[0] + i.
Last updated: Jun 27, 2026

Related Coding Questions

  • Remove Target Values from a Linked List - Arista (easy)
  • Find missing value in sorted consecutive array - Arista (easy)

Loading coding console...

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.