Last active
November 26, 2023 07:56
-
-
Save oguz-ismail/964bd7ee645ace3bdcc1f3d43cc91c0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
adapters[$0] | |
} | |
$0 > max { | |
max = $0 | |
} | |
END { | |
adapters[0] | |
count[max] = 1 | |
for (adapter = max; adapter > 0; adapter--) { | |
if (!(adapter in adapters) || adapter in seen) | |
continue | |
for (i = 1; i <= 3; i++) | |
if (adapter-i in adapters) | |
count[adapter-i] += count[adapter] | |
seen[adapter] | |
} | |
print count[0] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment