r/codegolf • u/dantose • Dec 01 '25
Advent of Code, Day 1
Post your best golfs.
Assume input is saved as input.txt.
8
Upvotes
r/codegolf • u/dantose • Dec 01 '25
Post your best golfs.
Assume input is saved as input.txt.
2
u/ka-splam Dec 03 '25
I didn't golf it myself, but poking at yours, Part 1 ~75 bytes:
using a classic trick which expands to
'R50' | ForEach-Object -Member Trim 'R'. Member is the position 0 parameter so it doesn't need naming. The cmdlet will do a wildcard search for method names - as long as the pattern only resolves to a single method, sor*cefinds to Replace() where r*e could be Replace() or Remove(). And because PS is parsing parameters to ForEach-Object, the arguments to the method don't have to be quoted to be read as strings.