PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Coinbase

Implement Composable Range Iterators

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of iterator design, lazy evaluation, composable higher-order combinators (map, filter, zip, take, drop, chain), edge-case handling for forward/backward and negative-step ranges, overflow-safe termination, peekable semantics, iterator invalidation rules, and writing boundary-focused unit tests.

  • Medium
  • Coinbase
  • Coding & Algorithms
  • Software Engineer

Implement Composable Range Iterators

Company: Coinbase

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Implement an iterator library: range(start, end, step= 1) supporting forward/backward iteration, inclusive/exclusive endpoints, negative steps, and overflow-safe termination. Provide lazy combinators map, filter, zip, take(n), drop(n), and chain, each with O( 1) extra space and amortized O( 1) per element. Add a PeekableIterator with peek() and hasNext(); discuss whether and how reset()/rewind() can be supported without materializing the sequence. Define iterator invalidation rules when the underlying collection changes. Write unit tests for boundary cases (very large ranges, zero step, empty ranges, negative steps) and demonstrate usage in your preferred language.

Quick Answer: This question evaluates understanding of iterator design, lazy evaluation, composable higher-order combinators (map, filter, zip, take, drop, chain), edge-case handling for forward/backward and negative-step ranges, overflow-safe termination, peekable semantics, iterator invalidation rules, and writing boundary-focused unit tests.

Related Interview Questions

  • Implement an In-Memory Database - Coinbase (hard)
  • Implement a Coin-Constrained Jump Strategy - Coinbase (hard)
  • Implement Game Physics and Block Mining - Coinbase (hard)
  • Compute Total Manual Distance - Coinbase (medium)
  • Implement a Flappy Bird Jump Agent - Coinbase
Coinbase logo
Coinbase
Sep 6, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
3
0

Implement an iterator library: range(start, end, step=

  1. supporting forward/backward iteration, inclusive/exclusive endpoints, negative steps, and overflow-safe termination. Provide lazy combinators map, filter, zip, take(n), drop(n), and chain, each with O(
  2. extra space and amortized O(
  3. per element. Add a PeekableIterator with peek() and hasNext(); discuss whether and how reset()/rewind() can be supported without materializing the sequence. Define iterator invalidation rules when the underlying collection changes. Write unit tests for boundary cases (very large ranges, zero step, empty ranges, negative steps) and demonstrate usage in your preferred language.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

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