PWC #236, Task 1

Run Settings
LanguageRaku
Language Version
Run Command
# URL: https://theweeklychallenge.org/blog/perl-weekly-challenge-236/#TASK1 my %change is BagHash; put so $*IN.words».&can-pay(%change).all; my method can-pay($bill : %change --> Bool:D) { my $remain = $bill - 5; return False if $remain < 0; while $remain > 0 { my $bill_ = %change.keys.sort(-*).first(* ≤ $remain); return False without $bill_; --%change{$bill_}; $remain -= $bill_; } ++%change{$bill}; True }
Editor Settings
Theme
Key bindings
Full width
Lines