Created
December 3, 2025 17:11
-
-
Save remy/24539571a53d74b21c15e0c6925fcd57 to your computer and use it in GitHub Desktop.
jq -R -rn -f ./3-b.jq ./3.input
This file contains hidden or 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
| def findLargest($n): | |
| . as $_ | | |
| .[0:(if $n == 1 then length else 1-$n end)] | max as $max | | |
| $_ | index($max) as $index | | |
| if ($n - 1) > 0 then | |
| [$max] + ($_[$index+1:] | findLargest($n-1)) | |
| else | |
| [$max] | |
| end | |
| ; | |
| [inputs | split("") | map(tonumber) | findLargest(12) | join("") | tonumber] | add |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the code translated to JS: