← Cloudkitchens Interview Insights

Cloudkitchens·Software Engineer·Online Assessment (OA)·Intermediate

Intermediate
Jul 2026

Summary

CloudKitchens SWE interview was a multi-level OA where you build out an in-memory cloud storage system from scratch, adding features layer by layer. The problem itself is pretty involved and covers file management, user quotas, merging, backups, and size transforms. No system design fluff, just pure implementation.

Questions Asked (4)

Q1

Design and implement an in-memory cloud storage system with basic file operations: adding a file (failing on duplicate names), retrieving a file's size, and deleting a file.

Algorithms & Data StructuresSystem Design
Author's notes

This part is straightforward.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a hash map-based design for O(1) operations. Walk through the implementation of each operation, discussing edge cases and potential optimizations.

Pro tip: Mention that in a real system, you'd consider concurrency and persistence, but for this in-memory version, focus on thread-safety if needed. Also, discuss how you'd handle large files (e.g., storing metadata vs. content).

1. Clarify Requirements

Ask about expected file sizes, number of files, concurrency needs, and whether file content needs to be stored or just metadata.

2. Design Data Structure

Propose using a hash map (dictionary) to store file names as keys and file metadata (size, content pointer) as values, ensuring O(1) average time for add, get size, and delete.

3. Implement Operations

Detail each operation: add checks for duplicates and inserts; get size returns the size or an error if not found; delete removes the entry and returns success/failure.

4. Handle Edge Cases

Discuss handling of null/empty names, very large files, and potential memory constraints. Mention error handling for non-existent files.

5. Discuss Extensions

Briefly mention how to extend to support concurrency (locks), persistence (write-ahead log), or additional operations (list files).

Key Points to Mention

  • Use of hash map for O(1) average time complexity
  • Duplicate file name detection and error handling
  • Memory management considerations for large files
  • Thread-safety and concurrency if multiple clients
  • Potential for persistence and scalability beyond in-memory
  • Clear API design with method signatures and return types

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Extend the storage system to support per-user file ownership and a query that returns the top N files for a given user, filtered by name prefix and suffix, sorted by size descending with lexicographic name as a tiebreaker.

Algorithms & Data StructuresData Modeling
Author's notes

The sorting rule is where people slip up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a data model that associates files with users and supports efficient prefix/suffix filtering. Discuss indexing strategies (e.g., composite indexes or trie-based structures) to enable fast retrieval, and outline the query algorithm that filters, sorts, and limits results. Finally, analyze time/space complexity and trade-offs.

Pro tip: Mention that prefix and suffix filtering can be optimized by indexing on (user_id, name) for prefix and using a reversed name index for suffix, or by using a trie that supports both directions. Also, highlight that sorting by size descending with name tiebreaker can be done efficiently with a bounded priority queue (heap) of size N to avoid full sorting.

1. Clarify requirements and constraints

Ask about expected scale (number of users, files), read/write patterns, latency requirements, and whether prefix/suffix filters are mandatory or optional. Confirm if N is small or large, and if the query needs to be real-time.

2. Design data model and storage schema

Propose adding an owner_id field to the file metadata. Consider a table or document structure with fields: file_id, owner_id, name, size, and other metadata. Discuss normalization vs denormalization for query performance.

3. Choose indexing strategy

Suggest indexes to support efficient filtering: a composite index on (owner_id, name) for prefix queries, and a reversed name index or a separate suffix index for suffix queries. Alternatively, propose a trie or a combination of tries for prefix and suffix, or a suffix array.

4. Outline query algorithm

Describe the steps: filter by owner_id, apply prefix and suffix conditions (using indexes), then retrieve matching files. Use a min-heap of size N to maintain top N by size descending and name ascending (lexicographic) as tiebreaker, avoiding full sort.

5. Analyze complexity and trade-offs

Discuss time complexity: index lookup O(log M + K) where K is number of matches, heap operations O(K log N). Space complexity: indexes add overhead. Mention trade-offs between index maintenance cost and query speed, and alternatives like full scan if filters are not selective.

Key Points to Mention

  • Composite index on (owner_id, name) for prefix filtering
  • Reversed name index or suffix trie for suffix filtering
  • Bounded priority queue (min-heap) to find top N without full sort
  • Sorting criteria: size descending, then name lexicographic ascending
  • Trade-offs between index maintenance and query performance
  • Scalability considerations: sharding by owner_id, caching frequent queries

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Add user creation with capacity limits, a file-add operation that enforces per-user quotas, a capacity adjustment that auto-deletes the user's largest files if needed, and a user merge that transfers files while respecting the target user's capacity.

System DesignAlgorithms & Data StructuresData Modeling
Author's notes

adjust_capacity and merge_users are the meaty parts.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then design a data model that supports efficient capacity checks and file operations. Outline the core operations (user creation, file addition, capacity adjustment, user merge) and discuss algorithms and data structures to meet performance goals. Finally, address edge cases, concurrency, and scalability considerations.

Pro tip: Emphasize the importance of defining clear semantics for capacity limits and auto-deletion policies upfront, as ambiguous requirements can lead to costly rework. Also, consider using a priority queue or balanced tree to efficiently track largest files for deletion.

1. Clarify Requirements and Constraints

Ask questions to understand expected scale, consistency requirements, and exact semantics of capacity limits and auto-deletion. Confirm whether operations need to be atomic and how to handle concurrent requests.

2. Design Data Model and Core Structures

Propose a schema for users and files, including capacity and current usage. Choose data structures (e.g., max-heap or balanced BST) to efficiently find and delete largest files when needed.

3. Detail Each Operation and Algorithm

Explain step-by-step how to implement user creation, file addition with quota enforcement, capacity adjustment with auto-deletion, and user merge with capacity constraints. Discuss time/space complexity for each.

4. Address Edge Cases and Concurrency

Identify potential edge cases (e.g., merging users with insufficient capacity, deleting files during merge) and propose solutions. Discuss locking or transactional strategies to maintain consistency.

5. Discuss Scalability and Trade-offs

Consider how the design scales with many users and files, and trade-offs between different data structures or consistency models. Mention possible optimizations like caching or sharding.

Key Points to Mention

  • Choice of data structures for efficient largest-file retrieval (e.g., max-heap, balanced BST)
  • Atomicity and isolation for operations like merge and capacity adjustment
  • Handling of concurrent file additions and capacity checks (e.g., optimistic vs pessimistic locking)
  • Policy for auto-deletion: which files to delete, order, and whether to notify users
  • Capacity enforcement during merge: what happens if target user lacks space after transferring files
  • Scalability considerations: partitioning, caching, and asynchronous processing

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

Implement backup and restore for user files, plus compress (halve each file size) and decompress (double each file size, then enforce capacity by deleting largest files) operations.

System DesignAlgorithms & Data Structures
Author's notes

Restore was trickier than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then design a data model that tracks file metadata (size, compression state) and supports efficient operations. Implement backup/restore using snapshots or versioning, and handle compress/decompress with careful state management and capacity enforcement. Discuss trade-offs between time and space complexity, and consider edge cases like concurrent operations and failure recovery.

Pro tip: Demonstrate awareness of real-world constraints: compression may not always halve size exactly, so clarify assumptions and discuss how to handle non-ideal cases. Also, mention idempotency and atomicity for backup/restore to ensure data integrity.

1. Clarify Requirements and Constraints

Ask about file size limits, number of files, frequency of operations, and whether compression ratios are guaranteed. Clarify if backup/restore should be point-in-time or incremental, and how capacity enforcement interacts with decompression.

2. Design Data Structures

Propose a file system model with metadata (file ID, size, compression flag) and a backup store (e.g., versioned snapshots or a separate storage). Use a max-heap or balanced BST to efficiently find and delete largest files during capacity enforcement.

3. Implement Core Operations

For compress: update file size to half and mark as compressed. For decompress: double size, mark as uncompressed, then if total size exceeds capacity, repeatedly delete largest files until within limit. For backup: create a snapshot of current state; for restore: revert to a snapshot.

4. Handle Edge Cases and Concurrency

Address scenarios like compressing an already compressed file, restoring after deletions, and concurrent operations. Discuss locking or transactional guarantees to maintain consistency.

5. Analyze Complexity and Trade-offs

Analyze time and space complexity for each operation (e.g., O(log n) for heap operations). Discuss trade-offs between storing full backups vs. incremental, and between eager vs. lazy capacity enforcement.

Key Points to Mention

  • Use of appropriate data structures (e.g., max-heap) for efficient largest-file deletion
  • Backup strategies: full snapshot vs. incremental, and storage overhead
  • Atomicity and idempotency for backup/restore to prevent data corruption
  • Handling compression state to avoid double compression/decompression
  • Capacity enforcement algorithm and its impact on performance
  • Concurrency control (e.g., locking) to ensure consistency during operations

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.