Scramblies

From codewars.com by Edxael  (that’s me)

Write function scramble(str1,str2) that returns true if a portion of str1 characters can be rearranged to match str2, otherwise returns false.

For example:
str1 is 'rkqodlw' and str2 is 'world' the output should return true.
str1 is 'cedewaraaossoqqyt' and str2 is 'codewars' should return true.
str1 is ‘katas‘ and str2 is ‘steak‘ should return false.

Only lower case letters will be used (a-z). No punctuation or digits will be included.
Performance needs to be considered

Here is my Code:

Note:  The following code is not written by me, it was created by another user of codewars.com it belongs to the user: “Trobule

 

 

 

 

 

 

 



Copyright 2017. All rights reserved.

Posted January 9, 2017 by Edmundo in category "Ruby Examples