Quantcast
Viewing latest article 6
Browse Latest Browse All 20

Answer by Dom Hastings for Words with Easy Letters in a Word Search

Perl 5+-MList::Util+(min), 44 bytes

sub{$g=pop;map{min map$g=~s/$_/$_/g,/./g}@_}

Try it online!

Explanation

Not entirely dissimilar to other solutions, this is a function submission in Perl (unusual I know, but 1 byte shorter than my best "standard" attempt.

Takes the last argument as a string containing the grid, and every other argument as words to find. Iterates over each word (implicitly stored in $_, splits (/./g) and maps over each letter, returning the number of s///ubstitutions replacing the letter for itself, taking the minimum for each word.


Viewing latest article 6
Browse Latest Browse All 20

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>