Question: please i need code in rudy code style for both the count_words and anagram_groups and the instructions for each are below this for the count_words
this for the count_words and
for the anagram_groups thank you end def count_words # your code here end def anagram groups your code here end end # make all the above functions available as insta class String include FunWithStrings end Remove the disabled => true from the 'word count' collection in the spec/fun_with_strings_spec.rb file. Don't forget to save your changes! Define a function 'count_words' that, given an input string, will return a hash whose keys are words in the string and whose values are the number of times each word appears: "To be or not to be" # => {"to"=>2, "be"=>2, "or"=>1, "not"=>1} Notes: Your solution shouldn't use for-loops, but iterators like 'each' are permitted. As before, nonwords and case should be ignored. A word is defined as a string of characters between word boundaries, Remove the, :disabled => true from the 'anagram grouping' collection in the spec/fun_with_strings_spec.rb file. Don't forget to save your changes! An anagram group is a group of words such that any one can be converted into any other just by rearranging the letters. For example, "rats", "tars" and "star" are an anagram group. Given a space separated list of words in a single string. write a method called 'anagram_groups' that groups these words into anagram groups and returns a nested array of those groups (an array of arrays). Hint: Look at the spec file to see what kind of return value is expected! Notes: Case doesn't matter in classifying string as anagrams (but case should be preserved in the output) The order of the anagrams in the groups doesn't matter
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
