DEV Community

Discussion on: #4.Basic algorithms problems for frontend developers.

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited
const mostFrequent = s=>([...s].sort().join('').match(/(\w)\1+/g)?.sort((a,b)=>b.length-a.length)[0]||s.match(/\w/))[0]
Enter fullscreen mode Exit fullscreen mode
Collapse
 
talenttinaapi profile image
talent

simple and straight forward

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

Yup, doesn't need any explanation 😉