function scramble(str1, str2) { let letterHolder = {}; for (let letter of str1) { if(letterHolder[letter]) letterHolder[letter]++; else letterHolder[letter] = 1; } for (let letter of str2) { if(!letterHolder[letter]) return false else letterHolder[letter]--; } return true; }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Discussion on: Daily Coding Puzzles - Nov 4th - Nov 9th
Replies for: Thursday Scramblies (5 KYU): Complete the function scramble(str1, str2) that returns true if a portion of str1 characters can be rearranged to m...
For further actions, you may consider blocking this person and/or reporting abuse