How to solve the Codewars's Scramblies

Today I try to solve the algorithm problem of codewars.

Description

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

Examples

  • scramble(‘rkqodlw’, ‘world’) -> True

  • scramble(‘cedewaraaossoqqyt’, ‘codewars’) -> True

  • scramble(‘katas’, ‘steak’) -> False

Code

  • split : returns array of strings computed by splitting.

  • equals : returns true if the String are equal.

Similar to the bubble sort algorithm. However, if finds a value, erases it.

public class Scramblies {
    public static boolean scramble(String str1, String str2) {
            # Codewars COC 정책으로 인하여 코드 제거
        return str2.length() == count;
    }
}
Written on December 3, 2018