Created
October 25, 2018 12:03
-
-
Save travelingtonic/fc8d51cc754dadc54cd6466ac845cbc4 to your computer and use it in GitHub Desktop.
Object Challenge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get all the text and convert to lower case then remove? any punctuation marks. | |
create an array to store all the words in the text | |
loop through the text array and if a given word is already in the text count array increment its count by 1. If a given word is not already in the text count array then add it to the array with a count of 1. | |
set first item in word count array as the highest max word and count | |
loop through each word in the word count array against the current highest and if higher count than current set highest to new current word | |
At end of loop return back the highest count word and its count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment