A word game arranges several different word cards from left to right. Generate all possible word card codes by choosing exactly one character from each word.
Characters in every code must follow the order of the word cards. Return the codes in the order obtained by considering the characters of each word from left to right.
List<String> generateWordCardCodes(List<String> wordCards)
wordCards: The words displayed on the cards in their left-to-right order.A list containing every code that can be created by choosing one character from each word.
1 ≤ wordCards.size() ≤ 43 ≤ wordCards.get(i).length() ≤ 4wordCards are different.generateWordCardCodes(wordCards = ["ace", "fit"])
Returns ["af", "ai", "at", "cf", "ci", "ct", "ef", "ei", "et"].
One character is selected from "ace", followed by one character from "fit".
generateWordCardCodes(wordCards = ["lamp"])
Returns ["l", "a", "m", "p"].
generateWordCardCodes(wordCards = ["dog", "rice"])
Returns ["dr", "di", "dc", "de", "or", "oi", "oc", "oe", "gr", "gi", "gc", "ge"].