PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Snowflake

Design an in-memory filesystem and circular queue

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's skills in data-structure and algorithm design, API specification, correctness reasoning, and time/space complexity analysis within the Coding & Algorithms domain by combining an in-memory hierarchical filesystem design with a fixed-size circular queue implementation.

  • Medium
  • Snowflake
  • Coding & Algorithms
  • Software Engineer

Design an in-memory filesystem and circular queue

Company: Snowflake

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Part A — Design an in-memory hierarchical file system. Requirements: - Support operations: ls(path), mkdir(path), createFile(path, content), appendToFile(path, content), readFile(path). - Paths are absolute UNIX-style. Root is "/". No trailing slash except for "/". - Error handling: if any intermediate subfolder in the path does not exist, return an error and do not create missing directories. For example, mkdir("/a/b") should error if "/a" is missing; createFile("/a/b/c.txt", ...) should error if "/a/b" is missing. - ls(path): if path is a directory, return its child names in lexicographic order; if path is a file, return [fileName]. - Assume no permissions or concurrency. Handle invalid inputs (empty segment, duplicate slashes). Scale to a large number of paths efficiently. Tasks: 1) Specify data structures and APIs. 2) Implement the operations. 3) Analyze time and space complexity per operation and overall. 4) Explain edge cases around the root directory and invalid paths. Part B — Implement a fixed-size circular queue. Requirements: - Constructor(capacity). - Operations: enQueue(x): bool, deQueue(): bool, Front(): optional<int>, Rear(): optional<int>, isEmpty(): bool, isFull(): bool. - All operations must be O( 1) time and O(capacity) space. Tasks: 1) Implement the queue. 2) Explain your choice of data structure (e.g., doubly linked list vs circular array) and trade-offs. 3) Prove correctness and analyze complexity.

Quick Answer: This question evaluates a candidate's skills in data-structure and algorithm design, API specification, correctness reasoning, and time/space complexity analysis within the Coding & Algorithms domain by combining an in-memory hierarchical filesystem design with a fixed-size circular queue implementation.

Related Interview Questions

  • Implement a JSON Parser - Snowflake (hard)
  • Solve Matrix and Array Distance Problems - Snowflake (medium)
  • Solve Array Distance and Wiki Navigation - Snowflake (medium)
  • Implement Document Predicate APIs - Snowflake (medium)
  • Find Shortest Wiki Click Path - Snowflake (medium)
|Home/Coding & Algorithms/Snowflake

Design an in-memory filesystem and circular queue

Snowflake logo
Snowflake
Aug 11, 2025, 12:00 AM
MediumSoftware EngineerTechnical ScreenCoding & Algorithms
5
0

Part A — Design an in-memory hierarchical file system. Requirements:

  • Support operations: ls(path), mkdir(path), createFile(path, content), appendToFile(path, content), readFile(path).
  • Paths are absolute UNIX-style. Root is "/". No trailing slash except for "/".
  • Error handling: if any intermediate subfolder in the path does not exist, return an error and do not create missing directories. For example, mkdir("/a/b") should error if "/a" is missing; createFile("/a/b/c.txt", ...) should error if "/a/b" is missing.
  • ls(path): if path is a directory, return its child names in lexicographic order; if path is a file, return [fileName].
  • Assume no permissions or concurrency. Handle invalid inputs (empty segment, duplicate slashes). Scale to a large number of paths efficiently. Tasks:
  1. Specify data structures and APIs.
  2. Implement the operations.
  3. Analyze time and space complexity per operation and overall.
  4. Explain edge cases around the root directory and invalid paths.

Part B — Implement a fixed-size circular queue. Requirements:

  • Constructor(capacity).
  • Operations: enQueue(x): bool, deQueue(): bool, Front(): optional <int> , Rear(): optional <int> , isEmpty(): bool, isFull(): bool.
  • All operations must be O(
  1. time and O(capacity) space. Tasks:
  2. Implement the queue.
  3. Explain your choice of data structure (e.g., doubly linked list vs circular array) and trade-offs.
  4. Prove correctness and analyze complexity.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

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