about | help | code help+videos | done | prefs |
(MEDIUM) Given an input str and a target str, find and return the index in which an anagram of target occurs in str. Look out though: str will contain spaces and other non-letter characters, as well as capitalization. If target is not found within str, return -1 just like indexOf. Preconditions: target will contain only lowercase letters, str and target will both have length > 0. HINT: searching through an alternate String might be easier, right? But then, how do you keep track of the original index positions? Also: a helper method for finding anagrams sounds fantastic.apcsaIndexOfAnagram("I wish, I wish upon a fish", "fashion") → 17 apcsaIndexOfAnagram("I am directing you to answer!", "direct") → 5 apcsaIndexOfAnagram("Find me my credit card.", "direct") → 11 ...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