Can a target string be formed using double-sided letter cards (each card used at most once)?

You are given cards, where each card has two sides and each side contains one lowercase English letter, e.g., cards = [["a","b"], ["c","d"]].

Rules:

  • Each card can be used at most once.
  • When a...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: