Write a function findDuplicateLetters(text) that finds the duplicate letters in text: the letters that occur more than once.
A and a are the same letter, so 'Aa' gives ['a'].a-z count. Digits, spaces, other characters and letters outside a-z (like é) are ignored.text. 'Programming' gives ['r', 'g', 'm'], not ['r', 'm', 'g'].A simple way is a counter for every letter in a Map, then a second pass over it.
findDuplicateLetters('Programming')Returns [ 'r', 'g', 'm' ]
findDuplicateLetters('Hello World')Returns [ 'l', 'o' ]
findDuplicateLetters('abc')Returns []
Asked at Amazon · Source
findDuplicateLetters('Programming')[ 'r', 'g', 'm' ]findDuplicateLetters('Hello World')[ 'l', 'o' ]findDuplicateLetters('abc')[]Hidden tests run on Submit.