id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

orion.a.smith@gmail.com apcsa-encryption > apcsaCountAnagrams
prev  |  next  |  chance

Given an input String and an ArrayList of other Strings to check against, calculate and return how many of the other Strings are anagrams of the input. Anagrams, remember, have all the same letters but in potentially different orders - spaces are not considered. Precondition: all the Strings in this problem have only lowercase letters and spaces in them.


HINTS: The spaces really don't matter.  Maybe they don't even need to be there?  Also the order of letters really doesn't matter here either.

CHALLENGE: solve with regular expressions, or with stream processing!

apcsaCountAnagrams("hello world", ["howled roll", "rolled howl", "goodbye world", "lewd oh roll", "hello door"]) → 3
apcsaCountAnagrams("finders keepers", ["losers weepers", "finders keepers", "redefines perks", "repressed knife", "finders keep hers", "defense per risk"]) → 4
apcsaCountAnagrams("infections wormholes", ["reinfection howl moss", "semicolons for the win", "eat at joes crabshack", "enrichments of you", "enrichments woof soil"]) → 3

...Save, Compile, Run (ctrl-enter)

public int apcsaCountAnagrams(String input, ArrayList<String> others) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 330

Copyright Nick Parlante 2017 - privacy