Jane Street logo

Jane Street

New York, NYTrading

Interview Questions

Adaptive Video Streaming Client

Asked at Jane Street
technical
system design
streaming
networking

Design client-side logic for a live streaming application with adaptive quality control.

Available APIs:

// Manifest API
interface QualityLevel {
  bitrate: number;
  resolution: string;
  segments: string[];
}
getManifest(): Promise<QualityLevel[]>

// Video Segment API
interface Segment {
  data: Uint8Array;
  duration: number;
}
fetchSegment(url: string): Promise<Segment>

// Player Control API
interface Player {
  play(): void;
  seek(time: number): void;
  switchQuality(level: QualityLevel): void;
}

Requirements:

  1. Quality Control
  • Monitor network conditions
  • Adjust video quality dynamically
  • Handle quality transitions smoothly
  1. Buffer Management
  • Maintain optimal buffer size
  • Prevent playback stalls
  • Handle network fluctuations
  1. Error Handling
  • Recover from segment failures
  • Handle manifest updates
  • Manage playback interruptions

Snake Game Implementation

Asked at Jane Street
technical
game design
algorithms
pathfinding

Design and implement the classic Snake game with path-finding optimization.

Game Components:

interface Position {
  x: number;
  y: number;
}

interface GameState {
  board: number[][];
  snake: Position[];
  apple: Position;
  score: number;
  direction: Direction;
}

enum Direction {
  UP,
  DOWN,
  LEFT,
  RIGHT
}

Requirements:

  1. Core Game Logic
  • M x N grid board
  • Snake movement (one cell at a time)
  • Apple generation
  • Collision detection
  • Score tracking
  1. Game Rules
  • Snake grows by 1 when eating apple
  • Game ends on self-collision
  • Score = apples eaten
  • Valid movement constraints

Follow-up: Path Finding

interface PathFinder {
  findOptimalPath(
    snake: Position[],
    apple: Position,
    board: number[][]
  ): Direction[];
}

Optimization Considerations:

  • Shortest path to apple
  • Avoid self-trapping
  • Handle dead-end scenarios
  • Consider snake length growth

Text Editor Backend Design

Asked at Jane Street
technical
system design
data structures
text processing

Implement a text editor backend with cursor and selection management.

Core Data Structures:

interface Cursor {
  position: number;
  selection: Selection | null;
}

interface Selection {
  start: number;
  end: number;
}

interface TextEditor {
  // Core Operations
  insert(text: string): void;
  delete(): void;
  select(start: number, end: number): void;
  copy(): string;
  paste(): void;
  
  // State Management
  getCursor(): Cursor;
  getText(): string;
}

Operation Requirements:

  1. Insert Operation
- Insert at cursor position
- Replace selected text if selection exists
- Update cursor position after insert
  1. Delete Operation
- Delete selected text if selection exists
- Delete character before cursor if no selection
- Update cursor and selection state
  1. Selection Management
- Set selection range
- Clear selection
- Validate selection bounds
- Handle cursor updates
  1. Clipboard Operations
- Copy selected text
- Handle empty selection
- Paste at cursor position
- Replace selected text on paste

Implementation Considerations:

  • Efficient string manipulation
  • Undo/redo support
  • Memory optimization
  • Performance for large texts

Share Your Experience at Jane Street