Implement a Fuzzy File Finder

Last updated: May 21, 2025

Quick Overview

Build a fuzzy file search that matches a query string against file paths in a project. Support subsequence matching, scoring based on match quality, and fast response times for projects with hundreds of thousands of files.

Cursor
Coding & Algorithms
Software Engineer
Cursor
May 21, 2025
Software Engineer
Technical Phone Screen
Coding & Algorithms
Easy

7

11

4,486 solved


Build a fuzzy file search that matches a query string against file paths in a project. Support subsequence matching, scoring based on match quality, and fast response times for projects with hundreds of thousands of files.

Every code editor has a fuzzy file finder (Cmd+P). This question tests your ability to implement a practical algorithm that balances match quality with performance. The scoring algorithm should prefer consecutive character matches, matches at word boundaries, and matches near the end of the path.

What the Interviewer Expects
  • Implement subsequence matching between a query and file paths
  • Design a scoring function that ranks results by match quality
  • Achieve sub-50ms response times for projects with 100K+ files
  • Handle case-insensitive matching with case-sensitive bonus scoring
Key Topics to Cover
Fuzzy string matching
Scoring and ranking algorithms
Performance optimization
Subsequence matching
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 a query that matches thousands of files?
  • How would you update the index when files are added or removed?
  • How would you incorporate recent file history into the ranking?
Sharpen Your Skills on Codemia

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

Practice DSA Problems
Sample Answer
Subsequence Matching

A query matches a path if all query characters appear in the path in order (not necessarily consecutively). Use two pointers: one for the query and on...

Scoring Function

Score each match based on five factors. Consecutive matches get a bonus (matching 'src' in 'src/index.ts' scores higher than matching characters sprea...


Submit Your Answer
Markdown supported

Related Questions