Google Interview Question

Write a Python function that receives a text file and a character, and returns a new file containing the text with the given character removed.

Interview Answer

Anonymous

Jun 25, 2026

I initially took a straightforward approach, suggesting that we read the file in small chunks up to each newline character. The issue with this approach is that the text might not contain any newline characters at all, causing my solution to fail. The correct solution is to chunk the text file by reading a constant number of characters at a time, regardless of line breaks.