PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates proficiency in string processing and character-frequency reasoning by combining tasks that measure longest distinct-character substring length and the index of the first non-repeating character.

  • easy
  • Boeing
  • Coding & Algorithms
  • Software Engineer

Compute unique-substring length and first unique index

Company: Boeing

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

Solve the following two string problems. ## Problem 1 — Longest substring with all distinct characters Given a string `s`, find the **length** of the longest contiguous substring that contains **no repeated characters**. - **Input:** `s` (ASCII or Unicode string) - **Output:** an integer length - **Constraints (typical):** `0 ≤ |s| ≤ 10^5` Example: - `s = "abcabcbb"` → output `3` (substring could be `"abc"`) ## Problem 2 — First unique character Given a string `s`, return the **index (0-based)** of the first character that appears **exactly once** in the entire string. If no such character exists, return `-1`. - **Input:** `s` - **Output:** integer index or `-1` - **Constraints (typical):** `0 ≤ |s| ≤ 10^5` Example: - `s = "leetcode"` → output `0` - `s = "aabb"` → output `-1`

Quick Answer: This question evaluates proficiency in string processing and character-frequency reasoning by combining tasks that measure longest distinct-character substring length and the index of the first non-repeating character.

Longest Substring Without Repeats

Return the length of the longest contiguous substring containing no repeated characters.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: ('abcabcbb',)

Expected Output: 3

Explanation: The longest distinct substring has length 3.

Input: ('bbbbb',)

Expected Output: 1

Explanation: Only one distinct character can be used.

Input: ('',)

Expected Output: 0

Explanation: Empty string has length 0.

Hints

  1. Clarify edge cases before coding.
  2. Keep the return value deterministic.

First Unique Character Index

Return the 0-based index of the first character that appears exactly once, or -1.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: ('leetcode',)

Expected Output: 0

Explanation: l is unique at index 0.

Input: ('loveleetcode',)

Expected Output: 2

Explanation: v is the first unique character.

Input: ('aabb',)

Expected Output: -1

Explanation: No unique character exists.

Hints

  1. Clarify edge cases before coding.
  2. Keep the return value deterministic.
Last updated: Jun 27, 2026

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
  • AI Coding 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.