Word Unscrambler

Write a function word_unscrambler that takes two inputs: a scrambled word and a dictionary of real words. Your program must then output all words that our scrambled word can unscramble to.

Hint: To see if a string `s1` is an anagram of `s2`, split both strings into arrays of letters. Sort the two arrays. If they are equal, then they are anagrams.

My solution: 

screen-shot-2016-11-29-at-6-45-34-pm

Provided solution: 

screen-shot-2016-11-29-at-6-46-52-pm

Test Cases: 

screen-shot-2016-11-29-at-6-46-13-pm

 

Advertisements
Word Unscrambler

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s