diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-08-23 22:25:45 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-08-23 22:25:45 +0100 |
| commit | 90e900f8ea65ecc368fbe8d106644fcf6142d5fa (patch) | |
| tree | 15b5d91a87138cb727361530845a35dd65b7a4ac /challenge-074 | |
| parent | 5151138f5535d34ec708c8b2be5292bd15173ddb (diff) | |
| download | perlweeklychallenge-club-90e900f8ea65ecc368fbe8d106644fcf6142d5fa.tar.gz perlweeklychallenge-club-90e900f8ea65ecc368fbe8d106644fcf6142d5fa.tar.bz2 perlweeklychallenge-club-90e900f8ea65ecc368fbe8d106644fcf6142d5fa.zip | |
- Added APL solutions by Richard Park.
Diffstat (limited to 'challenge-074')
| -rw-r--r-- | challenge-074/richard-park/apl/FNRCharacter.aplf | 9 | ||||
| -rw-r--r-- | challenge-074/richard-park/apl/MajorityElement.aplf | 5 | ||||
| -rw-r--r-- | challenge-074/richard-park/apl/ch-1.aplf | 5 | ||||
| -rw-r--r-- | challenge-074/richard-park/apl/ch-2.aplf | 9 | ||||
| -rw-r--r-- | challenge-074/richard-park/blog.txt | 1 |
5 files changed, 29 insertions, 0 deletions
diff --git a/challenge-074/richard-park/apl/FNRCharacter.aplf b/challenge-074/richard-park/apl/FNRCharacter.aplf new file mode 100644 index 0000000000..1ed3fe014e --- /dev/null +++ b/challenge-074/richard-park/apl/FNRCharacter.aplf @@ -0,0 +1,9 @@ + FNRCharacter←{ + FNR←{ + fnr←⊃⌽' '~⍨,(⊣(⌿⍨)(1=(≢⊢)))⌸⍵ ⍝ Last non-repeating element + ' '≡fnr:'#' ⍝ No unique elements + fnr + } + FNR¨(↑∘⍵)¨⍳≢⍵ ⍝ "First" Non-Repeating characters + ⍝ In subsets of ⍵ of length 1 to ≢⍵ + } diff --git a/challenge-074/richard-park/apl/MajorityElement.aplf b/challenge-074/richard-park/apl/MajorityElement.aplf new file mode 100644 index 0000000000..cc4207f8d1 --- /dev/null +++ b/challenge-074/richard-park/apl/MajorityElement.aplf @@ -0,0 +1,5 @@ + MajorityElement←{ + me←(∪⍵)⌿⍨((≢⊢)⌸⍵)>(⌊2÷⍨≢⍵) ⍝ Majority major cell + (,0)≡⍴me:¯1 ⍝ No majority major cell + me + } diff --git a/challenge-074/richard-park/apl/ch-1.aplf b/challenge-074/richard-park/apl/ch-1.aplf new file mode 100644 index 0000000000..cc4207f8d1 --- /dev/null +++ b/challenge-074/richard-park/apl/ch-1.aplf @@ -0,0 +1,5 @@ + MajorityElement←{ + me←(∪⍵)⌿⍨((≢⊢)⌸⍵)>(⌊2÷⍨≢⍵) ⍝ Majority major cell + (,0)≡⍴me:¯1 ⍝ No majority major cell + me + } diff --git a/challenge-074/richard-park/apl/ch-2.aplf b/challenge-074/richard-park/apl/ch-2.aplf new file mode 100644 index 0000000000..1ed3fe014e --- /dev/null +++ b/challenge-074/richard-park/apl/ch-2.aplf @@ -0,0 +1,9 @@ + FNRCharacter←{ + FNR←{ + fnr←⊃⌽' '~⍨,(⊣(⌿⍨)(1=(≢⊢)))⌸⍵ ⍝ Last non-repeating element + ' '≡fnr:'#' ⍝ No unique elements + fnr + } + FNR¨(↑∘⍵)¨⍳≢⍵ ⍝ "First" Non-Repeating characters + ⍝ In subsets of ⍵ of length 1 to ≢⍵ + } diff --git a/challenge-074/richard-park/blog.txt b/challenge-074/richard-park/blog.txt new file mode 100644 index 0000000000..82943408f3 --- /dev/null +++ b/challenge-074/richard-park/blog.txt @@ -0,0 +1 @@ +https://www.youtube.com/watch?v=JMW1SqIj0pM |
