aboutsummaryrefslogtreecommitdiff
path: root/challenge-074
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2020-08-23 22:25:45 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2020-08-23 22:25:45 +0100
commit90e900f8ea65ecc368fbe8d106644fcf6142d5fa (patch)
tree15b5d91a87138cb727361530845a35dd65b7a4ac /challenge-074
parent5151138f5535d34ec708c8b2be5292bd15173ddb (diff)
downloadperlweeklychallenge-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.aplf9
-rw-r--r--challenge-074/richard-park/apl/MajorityElement.aplf5
-rw-r--r--challenge-074/richard-park/apl/ch-1.aplf5
-rw-r--r--challenge-074/richard-park/apl/ch-2.aplf9
-rw-r--r--challenge-074/richard-park/blog.txt1
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