Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Normalize Google Docs Edit History

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Normalize Google Docs Edit History. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

In Google Docs, a simple edit log can be represented as a string where lowercase letters mean typed characters and # means backspace. Write a function that returns the final text after processing the entire log.

This problem tests whether you can write clean, maintainable, and efficient code for a straightforward string-processing task.

Formal Specification

  • Input: A string log containing lowercase English letters and the # character.
  • Output: A string representing the final text after applying all backspaces from left to right.
  • If a backspace appears when the current text is empty, it has no effect.

Constraints

  • 1 <= len(log) <= 10^5
  • log contains only lowercase English letters and '#'
  • A backspace on empty text has no effect

Function Signature

def normalize_edit_log(log):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output