Quantcast
Channel: Landmine Number V - Code Golf Stack Exchange
Viewing all articles
Browse latest Browse all 14

Answer by Leo for Landmine Number V

$
0
0

Husk, 7 bytes

Σפ=…Ṗ3

Try it online!

Makes good use of the range operator, which given a list of characters fills in all the missing characters to leave no gaps in the alphabet. For example:

…"CF" => "CDEF"

…"ADB" => "ABCDCB"

The key here is realising that a three-letters subsequence from the landscape will match the flag IFF the two are equal when is applied to both of them.

Explanation

Σפ=…Ṗ3Ṗ3    Get a list of all (ordered) 3-letter subsequences from the landscape×         For each of these subsequences and each flag:¤=…       check if they are equal when … is applied to both (returns 1 or 0)Σ          Sum all the results

Viewing all articles
Browse latest Browse all 14

Trending Articles



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