Google interview question

Truncate a string to given truncated digits