Skip to content

Instantly share code, notes, and snippets.

@oguz-ismail
Last active November 26, 2023 07:56
Show Gist options
  • Save oguz-ismail/964bd7ee645ace3bdcc1f3d43cc91c0f to your computer and use it in GitHub Desktop.
Save oguz-ismail/964bd7ee645ace3bdcc1f3d43cc91c0f to your computer and use it in GitHub Desktop.
{
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