In this post, we are going to discuss leetcode 1096 — Brace Expansion II, which is asked in Google interviews.
Problem Analysis
Under the grammar given below, strings can represent a set of lowercase words. Let
R(expr)
denote the set of words the expression represents.The grammar can best be understood through simple examples:
Single letters represent a singleton set containing that word:
R("a") = {"a"}
R("w") = {"w"}
When we take a…