3 posts shown.
coastaltiger39 said:Thanks for the help ... any chance you could write out the whole thing using functions? I'm still pretty much a total newbie at this stuff... 🙂
And honestly, I just need the count of duplicate letters, not actually knowing which ones they are.
Michelle Bennett5 said:Basically, you build a boolean matrix for tracking usage, sized to the number of letters in the first word.
Then you run a loop through every letter of the second word.
Inside that, you run another loop through all the letters of the first word.
If the current letter from the second word matches one from the first, and that spot in the first word hasn't been "used" yet...
Mark that position in the first word as used.
Add the matching letter to a list.
Break out of the inner loop.
Once the outer loop finishes, just count up how many—and which ones—were found.
--
This logic should mirror the task requirements and match those example solutions.
Thanks for the help ... any chance you could write out the whole thing using functions? I'm still pretty much a total newbie at this stuff... 🙂
I need some help here!
I'm trying to compare two words to see how many matching letters they share.
Here’s what I mean:
apple, egg = 2 (e, p)
apple, butter = 2 (p, e)
potato, bread = 3 (p, t, o)