public class Solution {
public string Interpret(string command) {
var replaceWith = new Dictionary<string, string>()
{
["()"] = "o",
["(al)"] = "al"
};
foreach (var (key, value) in replaceWith) {
command = command.Replace(key, value);
}
return command;
}
}
Source: https://leetcode.com/problems/goal-parser-interpretation/submissions/
"Simplicity can't be bought later, it must be earned from the start" -- DB
Monday, February 15, 2021
Leetcode Everyday: 1678. Goal Parser Interpretation. Easy
Labels:
leetcode
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment