diff options
| author | Myoungjin JEON <jeongoon@gmail.com> | 2020-10-18 22:50:01 +1100 |
|---|---|---|
| committer | Myoungjin JEON <jeongoon@gmail.com> | 2020-10-18 22:50:01 +1100 |
| commit | a0739217c351727205e92b3fb58c764afa44064b (patch) | |
| tree | b7554f59d66fa3dc132674946c424e30be4e9484 | |
| parent | 6af56317002b67a415db1f0c6b188149918fbf46 (diff) | |
| download | perlweeklychallenge-club-a0739217c351727205e92b3fb58c764afa44064b.tar.gz perlweeklychallenge-club-a0739217c351727205e92b3fb58c764afa44064b.tar.bz2 perlweeklychallenge-club-a0739217c351727205e92b3fb58c764afa44064b.zip | |
[ch-082/jeongoon] ch-2.pl typo and commnet
| -rw-r--r-- | challenge-082/jeongoon/perl/Ch2PlanA.pm | 7 |
1 files changed, 6 insertions, 1 deletions
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!"; |
