aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Custodio <pauloscustodio@gmail.com>2023-03-23 19:24:23 +0000
committerPaulo Custodio <pauloscustodio@gmail.com>2023-03-23 19:24:23 +0000
commit19a608784387815b0dac448244689155e0fbd6b1 (patch)
tree41d1a1a273a71767eae2a20da0c9627b40099231
parent7edb70c0def87d648efab04eae738f0918503fc1 (diff)
downloadperlweeklychallenge-club-19a608784387815b0dac448244689155e0fbd6b1.tar.gz
perlweeklychallenge-club-19a608784387815b0dac448244689155e0fbd6b1.tar.bz2
perlweeklychallenge-club-19a608784387815b0dac448244689155e0fbd6b1.zip
incomplete
-rw-r--r--challenge-209/paulo-custodio/forth/ch-2.fs32
1 files changed, 32 insertions, 0 deletions
diff --git a/challenge-209/paulo-custodio/forth/ch-2.fs b/challenge-209/paulo-custodio/forth/ch-2.fs
new file mode 100644
index 0000000000..68740dc2e1
--- /dev/null
+++ b/challenge-209/paulo-custodio/forth/ch-2.fs
@@ -0,0 +1,32 @@
+#! /usr/bin/env gforth
+
+\ Challenge 209
+\
+\ Task 2: Merge Account
+\ Submitted by: Mohammad S Anwar
+\
+\ You are given an array of accounts i.e. name with list of email addresses.
+\
+\ Write a script to merge the accounts where possible. The accounts can only
+\ be merged if they have at least one email address in common.
+\
+\ Example 1:
+\
+\ Input: @accounts = [ ["A", "a1@a.com", "a2@a.com"],
+\ ["B", "b1@b.com"],
+\ ["A", "a3@a.com", "a1@a.com"] ]
+\ ]
+\
+\ Output: [ ["A", "a1@a.com", "a2@a.com", "a3@a.com"],
+\ ["B", "b1@b.com"] ]
+\
+\ Example 2:
+\
+\ Input: @accounts = [ ["A", "a1@a.com", "a2@a.com"],
+\ ["B", "b1@b.com"],
+\ ["A", "a3@a.com"],
+\ ["B", "b2@b.com", "b1@b.com"] ]
+\
+\ Output: [ ["A", "a1@a.com", "a2@a.com"],
+\ ["A", "a3@a.com"],
+\ ["B", "b1@b.com", "b2@b.com"] ]