PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Bridge

Solve path normalization and nested iterator

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in string/path normalization, manipulation of hierarchical data structures, stack-based iterator design, lazy versus eager flattening strategies, and algorithmic time/space complexity analysis in the Coding & Algorithms domain.

  • Medium
  • Bridge
  • Coding & Algorithms
  • Software Engineer

Solve path normalization and nested iterator

Company: Bridge

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

1) Normalize Unix-style absolute paths: Given a string representing an absolute Unix file path, return its canonical form. Rules: '.' refers to the current directory, '..' moves one directory up (ignore if already at root), multiple consecutive slashes are treated as a single slash, and no trailing slash should appear in the result except for the root '/'. Implement normalizePath(path: string) and explain your algorithm, time complexity, and space complexity. 2) Implement a nested-list iterator: Given a nested collection containing integers and lists (which themselves may contain integers or lists arbitrarily), design an iterator that outputs the integers from left to right. Implement hasNext() and next() with a lazy approach that uses a stack to avoid flattening everything up front; optionally discuss an eager alternative. Analyze time and space complexity and compare the trade-offs between the two designs.

Quick Answer: This question evaluates proficiency in string/path normalization, manipulation of hierarchical data structures, stack-based iterator design, lazy versus eager flattening strategies, and algorithmic time/space complexity analysis in the Coding & Algorithms domain.

Related Interview Questions

  • Design Minesweeper and Optimize Click Performance - Bridge (Medium)
Bridge logo
Bridge
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
8
0
  1. Normalize Unix-style absolute paths: Given a string representing an absolute Unix file path, return its canonical form. Rules: '.' refers to the current directory, '..' moves one directory up (ignore if already at root), multiple consecutive slashes are treated as a single slash, and no trailing slash should appear in the result except for the root '/'. Implement normalizePath(path: string) and explain your algorithm, time complexity, and space complexity.
  2. Implement a nested-list iterator: Given a nested collection containing integers and lists (which themselves may contain integers or lists arbitrarily), design an iterator that outputs the integers from left to right. Implement hasNext() and next() with a lazy approach that uses a stack to avoid flattening everything up front; optionally discuss an eager alternative. Analyze time and space complexity and compare the trade-offs between the two designs.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

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

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