PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Coinbase

Implement iterators and write tests in Java

Last updated: Mar 29, 2026

Quick Overview

This question evaluates implementation skills with Java generics, the iterator pattern and API design, along with unit testing and complexity analysis in the Coding & Algorithms domain.

  • Medium
  • Coinbase
  • Coding & Algorithms
  • Software Engineer

Implement iterators and write tests in Java

Company: Coinbase

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

In Java, write everything from scratch (no IDE scaffolding): 1) Define a generic Iterator<T> interface with hasNext() and next(). 2) Implement ArrayIterator<T> over a fixed array. 3) Implement PeekingIterator<T> that wraps any Iterator<T> and adds peek() without advancing. 4) Provide minimal unit tests that compile and run, covering empty input, single element, multiple elements, and calling next() when no elements remain. Analyze time/space complexity and edge cases.

Quick Answer: This question evaluates implementation skills with Java generics, the iterator pattern and API design, along with unit testing and complexity analysis in the Coding & Algorithms domain.

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
Jul 31, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
4
0

In Java, write everything from scratch (no IDE scaffolding):

  1. Define a generic Iterator <T> interface with hasNext() and next().
  2. Implement ArrayIterator <T> over a fixed array.
  3. Implement PeekingIterator <T> that wraps any Iterator <T> and adds peek() without advancing.
  4. Provide minimal unit tests that compile and run, covering empty input, single element, multiple elements, and calling next() when no elements remain. Analyze time/space complexity and edge cases.

Submit Your Answer to Earn 20XP

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 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.