about | help | code help+videos | done | prefs |
Given an ArrayList of words (all uppercase letters) that all have the same length, create and return an output "word" where each letter is the most frequently-occurring letter of the input words, at that index. So with the words: [SOW, SON, PIG, DOG, ABS]the output would be "SOG" since S is the most-frequent letter at index 0, O is most-frequent at index 1, and G is most-frequent at index 2. In the case of a tie between two or more letters that occur with the same frequency, use the letter earliest in the alphabet. Preconditions: words has at least one element, all elements of words are uppercase letters of the same length. apcsaMostCommonWord(["SOW", "SON", "PIG", "DOG", "ABS"]) → "SOG" apcsaMostCommonWord(["ABC", "DEF", "GHI", "JKL", "MNI"]) → "ABI" apcsaMostCommonWord(["GAUNT", "TOUTS", "LADEN", "OVARY", "MYTHS", "SAVOR", "JAZZY", "KAFIR", "JAMBS", "UNHIP", "COXED", "POLKA", "TRILL", "HOLEY", "CONEY", "ALLOY", "SHELF", "RAMIE", "PLASH", "QUOIT", "SOAVE"]) → "SAAEY" ...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: 330
Copyright Nick Parlante 2017 - privacy