about | help | code help+videos | done | prefs |
apcsaArraysAreAnagrams
Heads up, this is a harder problem. Huzzah! Given two arrays of ints arr1 and arr2, return whether the two arrays are "anagrams" of one another. When dealing with text, two words are anagrams if they have the same number of each letter, in each word. In this problem, return true if the two arrays have the same set of numbers in them. Precondition: arr1.length > 0, arr2.length > 0 EXAMPLES Is {0, 1, 2} an anagram of {2, 1, 0}? Yes: same numbers, different order. Is {2, 3, 3} an anagram of {3, 2, 2}? No: one of the arrays has two elements with the value 3 and one element with the value 2, the other has two elements with the value 2 and one element with the value 3. HINT: this problem definitely involves more than one loop, unless you use an API method call that does some work for you.apcsaArraysAreAnagrams([0, 1, 2], [2, 1, 0]) → true apcsaArraysAreAnagrams([2, 3, 3], [3, 2, 2]) → false apcsaArraysAreAnagrams([1, 2], [1, 2, 3]) → false ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 320
Copyright Nick Parlante 2017 - privacy