← Intuit Interview Insights

Intuit·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

Intuit software engineer interview with a parsing problem that looks simple but has a real edge case lurking in it. The kind of question where you feel good for about two minutes and then realize you missed something.

Questions Asked (1)

Q1

Given the output of `ls -l` passed through stdin, write a program that prints the file name of the entry with the largest file size. File names may contain spaces, and you should skip non-entry lines like `total N`.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I went straight for splitting on whitespace and grabbing index 4 for the size, which works fine until you remember file names can have spaces.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Read the input line by line, skip the 'total' line, and parse each entry to extract the file size and file name. Since file names can contain spaces, split the line into at most 9 fields (using whitespace as delimiter) so that the 9th field contains the full file name. Track the maximum size and corresponding file name, then output the file name.

Pro tip: Mention that you would handle edge cases such as empty input, multiple files with the same maximum size (choose the first or last based on requirements), and symbolic links (which show '->' in the name). Also, clarify that the size field is the 5th column in a standard `ls -l` output.

1. Read and filter input

Read each line from stdin. Skip lines that start with 'total' or are empty. For each remaining line, proceed to parse.

2. Parse size and file name

Split the line into at most 9 parts using whitespace as delimiter. The 5th part is the file size (as a string), and the 9th part is the file name (which may contain spaces). Convert the size to an integer.

3. Track maximum

Maintain variables for the maximum size seen so far and the corresponding file name. For each entry, if its size is greater than the current maximum, update both variables.

4. Output result

After processing all lines, print the file name associated with the largest size. If no valid entries were found, handle appropriately (e.g., print nothing or an error message).

Key Points to Mention

  • Parsing `ls -l` output: the size is the 5th column, and the file name is everything after the 8th column (fields 9+).
  • Handling file names with spaces: split with a limit (e.g., `split(' ', 8)` in Python or `split('\s+', 9)` in Java) to keep the name intact.
  • Skipping non-entry lines: ignore lines starting with 'total' and blank lines.
  • Edge cases: empty input, ties in maximum size, symbolic links (which include '->' in the name), and files with unusual characters.
  • Time and space complexity: O(n) time and O(1) extra space, where n is the number of lines.
  • Language-specific considerations: use appropriate string splitting and integer parsing methods, and handle potential exceptions.

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