PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Upstart

Find max word letter span

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in string processing, character mapping, and algorithmic analysis by requiring computation of per-word letter spans while accounting for case normalization, punctuation handling, ties, duplicates, and edge-case word forms.

  • Medium
  • Upstart
  • Coding & Algorithms
  • Software Engineer

Find max word letter span

Company: Upstart

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Implement a function that, given an input text string, computes the maximum word letter span and returns both (a) the maximum span and (b) the list of words that achieve that span. A word's letter span is the absolute distance between the first and last alphabetic letters in the word using positions a=0..z=25. Capitalization does not matter. Ignore punctuation and non-letter characters when determining the first and last letters. Words that begin and end with the same letter have span 0. The same two boundary letters yield the same span regardless of their order inside the word. Examples: "cab" -> 1, "pat" -> 4, "Float" -> 14, "wood" -> 19, "would" -> 19, "I" -> 0, "pop" -> 0; "can't" and "cannot." both have span 17. Return the maximum span and all words from the text that achieve it (state whether you return original surface forms or normalized forms). Analyze time and space complexity and explain how you handle ties, duplicates, contractions/hyphenations, and texts with no alphabetic words.

Quick Answer: This question evaluates proficiency in string processing, character mapping, and algorithmic analysis by requiring computation of per-word letter spans while accounting for case normalization, punctuation handling, ties, duplicates, and edge-case word forms.

Related Interview Questions

  • Implement Three Assessment Functions - Upstart (medium)
  • Solve Five OA Coding Tasks - Upstart (medium)
  • Solve Reported OA Coding Problems - Upstart (medium)
  • Decrypt a twice-encrypted message using known pairs - Upstart (medium)
  • Compute buffet revenue with capacity and waiting - Upstart (medium)
Upstart logo
Upstart
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
19
0

Implement a function that, given an input text string, computes the maximum word letter span and returns both (a) the maximum span and (b) the list of words that achieve that span. A word's letter span is the absolute distance between the first and last alphabetic letters in the word using positions a=0..z=25. Capitalization does not matter. Ignore punctuation and non-letter characters when determining the first and last letters. Words that begin and end with the same letter have span 0. The same two boundary letters yield the same span regardless of their order inside the word. Examples: "cab" -> 1, "pat" -> 4, "Float" -> 14, "wood" -> 19, "would" -> 19, "I" -> 0, "pop" -> 0; "can't" and "cannot." both have span 17. Return the maximum span and all words from the text that achieve it (state whether you return original surface forms or normalized forms). Analyze time and space complexity and explain how you handle ties, duplicates, contractions/hyphenations, and texts with no alphabetic words.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Upstart•More Software Engineer•Upstart Software Engineer•Upstart Coding & Algorithms•Software Engineer 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.