Search
⌘K

String Template Substitution with Variable Replacement

Implement a string substitution system that replaces placeholders or parts of a string with corresponding values from a given mapping. The solution should handle complex substitution scenarios including nested substitutions where replacement values may contain additional placeholders that need further resolution. Consider using backtracking or iterative approaches to handle all substitution cases correctly.

Asked at:

Google

Google


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early January, 2025

Google

Google

Mid-level

Implement a string template substitution tool. The tool should support substituting placeholders in a template string with corresponding values from a given mapping. It should handle nested substitutions where a substitution value can contain placeholders that need to be further resolved.

Late October, 2024

Google

Google

Mid-level

Replace parts of substring with values given in a map using backtracking

Comments

Your account is free and you can post anonymously if you choose.