DEV Community

Discussion on: Daily Challenge #299 - Time to Grille!

Collapse
 
wheatup profile image
Hao • Edited

Another JavaScript solution, using binary operations:

const Grille = (str, bin) => [...str].filter((_, i) => 1 << (str.length-i-1) & bin).join('');
Enter fullscreen mode Exit fullscreen mode