How should I start solving this class problem?

I need to check if it's possible to create 1 specific string from a selection of numbers and letters in another string. Like if I had an "available" string of "AABB12" then would I be able to create string "BA 112". I wouldn't be able to cause there is only one "1".
How do I start solving this problem? What is the logic or point behind this?

It seems like a brute force problem. The point is you try all combinations.

You have a string, convert it to a char and then try to adjust those chars positions until you get the word you wanted.
Last edited on
You could make a map of available letters in the first string, then when checking the second string count all instances of each letter, and check the map to see if you have that many.
Topic archived. No new replies allowed.