Back to problems

Template String Formatter II

Algorithm · Figma · Medium

Problem Statement You are given a template string text that may contain two kinds of expressions: Variable placeholders – written as "{varName}". Plural format blocks – written as "{varName, plural, one{# singularText} other{# pluralText}}". You also receive two parallel lists: keys and values, where keys[i] maps to values[i]. Your task is to produce the fully formatted string by applying the following rules: Rules Variable placeholder "{varName}": replace it with the…

Checking your access…