Group Duplicate OneDrive Files by Size and Content Hash

Last updated: November 29, 2026

Quick Overview

Given a list of files as (path, size, content) tuples from a OneDrive folder scan, return groups of paths whose contents are identical, including only groups with at least two files.

Microsoft
Coding & Algorithms
Software Engineer
Microsoft
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given a list of files as (path, size, content) tuples from a OneDrive folder scan, return groups of paths whose contents are identical, including only groups with at least two files.

A warm-up in the style of Microsoft phone screens for storage teams like OneDrive and SharePoint, where dedup saves real capacity. The interviewer checks whether you use hashing to group cheaply, and whether you avoid hashing every byte of every file when sizes already rule matches out.

What the Interviewer Expects
  • Group by a cheap key (size) before computing an expensive one (hash)
  • Use a dictionary of lists keyed by the composite key
  • Filter out singleton groups
  • Discuss hash collisions and when a byte compare is needed
  • State time in terms of total bytes hashed
Key Topics to Cover
hash maps
grouping
content hashing
deduplication
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you handle files too large to load into memory at once?
  • How would you make this incremental as new files are uploaded?
  • What if two different files collide on the hash?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input is a list of (path, size, content) tuples. Output is a list of groups (lists of paths) where each group shares identical content and has two or more members. Order of groups does not matter. C...

High-Level Design

Two-stage bucketing. First bucket files by size: files of different sizes can never be duplicates, so any size bucket with one file is skipped without reading its content. Inside each surviving size...


Submit Your Answer
Markdown supported