About
mftrhu on Keybase, GitHub, HackerNews, Reddit
I usually program in Python, but my first language - a long, long time ago - was Pascal, and lately I have gone back to it to solve these challenges. How d can get their solutions to be so fast is still beyond me.
A few notes on Pascal:
SetLength(arr, len)gives youarr[0..len-1], and not, as I misread,arr[1..len].- As a corollary to the previous item, dynamic arrays are mostly not necessary here.
- Unless messing around with
$mode, "Anintegeris 16-bit in TP or FPC modes, or 32-bit in ObjFPC or Delphi modes." - better useint32orint64instead. - Unless messing around with
$mode,stringwill be an alias forShortString, andShortStringcan only contain up to 255 characters (and will truncate the input silently) - better useAnsiStringinstead. - As a corollary to the previous two items, messing around with
$modeis probably a good idea as it seem to default to Turbo Pascal (tp) mode. Set{$mode fpc}to avoid some issues (e.g.casenot working with strings), set{$mode objfpc}to avoid the most common pitfalls.