← Verkada Interview InsightsSoftware Engineer

Verkada·Software Engineer·Technical Phone Screen·Intermediate

IntermediateRejected
Jun 2026Remote

Summary

Technical phone screen for a software engineering role at Verkada. The problem was genuinely interesting but I fumbled an edge case in the IP parsing logic and I'm pretty sure that cost me the round.

Questions Asked (1)

Q1

Given a filesystem path, recursively traverse all directories and files beneath it, extract all valid IP addresses found in file contents, and output them in lexicographic order.

Algorithms & Data StructuresSystem Design
Author's notes

The concept clicked fast but my Python os library knowledge just wasn't there.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements: what defines a valid IP (IPv4 only or IPv6?), how to handle large files, and whether symlinks should be followed. Then outline a solution that recursively walks the directory tree, reads each file, extracts IPs using a robust regex or parser, deduplicates, and sorts lexicographically. Discuss trade-offs between memory usage and streaming, and consider edge cases like binary files and permission errors.

Pro tip: Mention that you would use a streaming approach for large files to avoid loading entire contents into memory, and that you'd handle errors gracefully (e.g., skip unreadable files) while logging them for debugging. This shows production-level thinking beyond just algorithmic correctness.

1. Clarify requirements and constraints

Ask about IP version (IPv4/IPv6), definition of 'valid' (e.g., 0-255 octets), handling of symlinks, file size limits, and expected output format (e.g., one per line, deduplicated).

2. Design recursive traversal

Use a depth-first search (DFS) with a stack or recursion to visit all directories and files. Consider using os.walk in Python or Files.walk in Java for simplicity, but be prepared to implement manually if asked.

3. Extract IP addresses from file contents

For each file, read line-by-line or in chunks to handle large files. Apply a regex that matches valid IPv4 addresses (e.g., \b(?:\d{1,3}\.){3}\d{1,3}\b) and validate each octet is 0-255. For IPv6, use a more complex regex or a library.

4. Collect, deduplicate, and sort

Store found IPs in a set to avoid duplicates, then convert to a list and sort lexicographically (string sort). If memory is a concern, consider external sorting or a trie, but for most cases in-memory is fine.

5. Handle edge cases and errors

Skip binary files or detect them via null bytes. Catch and log permission errors, broken symlinks, and I/O exceptions. Discuss whether to follow symlinks (avoid cycles) and how to handle very deep directory structures.

Key Points to Mention

  • Use of a robust regex for IPv4 validation, ensuring each octet is 0-255 (e.g., not just \d{1,3}).
  • Streaming file reads to handle large files without excessive memory usage.
  • Deduplication using a set, and lexicographic sorting (string sort) of the final list.
  • Error handling for unreadable files, permission issues, and symlink cycles.
  • Consideration of IPv6 if required, and how the regex/parser would differ.
  • Time and space complexity: O(N) where N is total bytes read, plus O(K log K) for sorting K unique IPs.

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