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/
No comments:
Post a Comment