loading...

Common Character Count!!Swift Coding Challenge!!

twitter logo github logo ・1 min read

Swift coding challenge!!
Common Character Count, given two strings find the number of common characters between them.

πŸ˜› Level: Easy πŸ˜›

I have included a solutions video!! The video gives some insight into how I’ve solved the problem. Don’t forget to try the problem out BEFORE checking out the solution video and solution code πŸ˜‰ πŸ˜‰

If you have a coding challenge you want me to solve feel free to drop a comment or message me with the problem!! 😊 😊 let’s get swole πŸ’ͺ🏾 πŸ’» πŸ’»

twitter logo DISCUSS (2)
markdown guide
 

If I was given this question during an interview I'd have asked for clarification, as to me there are 2 common characters between the two strings: a and c. Why do I need to count a 2 times?
Under your assumption, the code you posted is correct and I think it is the easiest.
Only a little detail: characters is deprecated and you can iterate through the string by writing
for char in string {
...
}

 

Thanks for the tip about characters πŸ‘, I didn't realize it was deprecated. Back to for loops 😁

Classic DEV Post from Nov 13 '19

Apples announces new 16-inch Macbook Pro

Discussion thread for the new Macbook Pro thread

creator  profile image
πŸ₯” Engineer πŸ“±Founding CEO @bornbklynstudio

Customize your DEV feed to keep up with the technologies you care about.

Get Started