From a0739217c351727205e92b3fb58c764afa44064b Mon Sep 17 00:00:00 2001 From: Myoungjin JEON Date: Sun, 18 Oct 2020 22:50:01 +1100 Subject: [ch-082/jeongoon] ch-2.pl typo and commnet --- challenge-082/jeongoon/perl/Ch2PlanA.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/challenge-082/jeongoon/perl/Ch2PlanA.pm b/challenge-082/jeongoon/perl/Ch2PlanA.pm index 3e559e2a5b..398d48acf5 100644 --- a/challenge-082/jeongoon/perl/Ch2PlanA.pm +++ b/challenge-082/jeongoon/perl/Ch2PlanA.pm @@ -9,6 +9,9 @@ use List::Util qw(sum); our @EXPORT = qw(isInterleaving); +# non-recursive version because I saw so many recursive version already. +# I couldn't think my own version of recursive method. :-] + sub isInterleaving ($$$) { my ( $A, $B, $C ) = @_; my ( $Alen, $Blen, $Clen ) = map {length} @_; @@ -43,7 +46,7 @@ sub isInterleaving ($$$) { } elsif ( $Bi == $Blen ) { # used $B all # but no need to check plan B - # just because we are always take 'A' when we have to choose + # just because we always take 'A' when we have to choose $interleaved = ( substr $A, $Ai ) eq ( substr $C, $Ci ) } else { @@ -77,3 +80,5 @@ sub isInterleaving ($$$) { $interleaved } + +!"yes! no!"; -- cgit