diff options
| author | Mohammad Sajid Anwar <mohammad.anwar@yahoo.com> | 2024-08-19 10:39:02 +0100 |
|---|---|---|
| committer | Mohammad Sajid Anwar <mohammad.anwar@yahoo.com> | 2024-08-19 10:39:02 +0100 |
| commit | 77ecff551b5e341658ad156635933ddf47f5ef8e (patch) | |
| tree | 5396b6518146ec49b39ca2e3be2b6bfd43269b8e /challenge-283 | |
| parent | 01b241f1938d95a90c0d55a94c9822d6415f8741 (diff) | |
| download | perlweeklychallenge-club-77ecff551b5e341658ad156635933ddf47f5ef8e.tar.gz perlweeklychallenge-club-77ecff551b5e341658ad156635933ddf47f5ef8e.tar.bz2 perlweeklychallenge-club-77ecff551b5e341658ad156635933ddf47f5ef8e.zip | |
- Added solutions by Eric Cheung.
- Added solutions by Bob Lied.
- Added solutions by Mark Anderson.
- Added solutions by Peter Meszaros.
- Added solutions by Niels van Dijke.
- Added solutions by E. Choroba.
- Added solutions by Feng Chang.
Diffstat (limited to 'challenge-283')
| -rwxr-xr-x | challenge-283/eric-cheung/python/ch-1.py | 9 | ||||
| -rwxr-xr-x | challenge-283/eric-cheung/python/ch-2.py | 7 | ||||
| -rwxr-xr-x | challenge-283/perlboy1967/perl/ch-1.pl (renamed from challenge-283/perlboy1967/perl/ch1.pl) | 0 | ||||
| -rwxr-xr-x | challenge-283/perlboy1967/perl/ch-2.pl (renamed from challenge-283/perlboy1967/perl/ch2.pl) | 0 |
4 files changed, 16 insertions, 0 deletions
diff --git a/challenge-283/eric-cheung/python/ch-1.py b/challenge-283/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..beb8abb03d --- /dev/null +++ b/challenge-283/eric-cheung/python/ch-1.py @@ -0,0 +1,9 @@ +
+## arrInt = [3, 3, 1] ## Example 1
+## arrInt = [3, 2, 4, 2, 4] ## Example 2
+## arrInt = [1] ## Example 3
+arrInt = [4, 3, 1, 1, 1, 4] ## Example 4
+
+arrUniq = [nLoop for nLoop in set(arrInt) if arrInt.count(nLoop) == 1]
+
+print (arrUniq[0])
diff --git a/challenge-283/eric-cheung/python/ch-2.py b/challenge-283/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..ca95692560 --- /dev/null +++ b/challenge-283/eric-cheung/python/ch-2.py @@ -0,0 +1,7 @@ +
+## arrInt = [1, 2, 1, 0] ## Example 1
+arrInt = [0, 3, 0] ## Example 2
+
+arrOutput = [nLoop for nIndx, nLoop in enumerate(arrInt) if arrInt.count(nIndx) == nLoop]
+
+print (len(arrInt) == len(arrOutput))
diff --git a/challenge-283/perlboy1967/perl/ch1.pl b/challenge-283/perlboy1967/perl/ch-1.pl index d6286a2883..d6286a2883 100755 --- a/challenge-283/perlboy1967/perl/ch1.pl +++ b/challenge-283/perlboy1967/perl/ch-1.pl diff --git a/challenge-283/perlboy1967/perl/ch2.pl b/challenge-283/perlboy1967/perl/ch-2.pl index f6e882fd98..f6e882fd98 100755 --- a/challenge-283/perlboy1967/perl/ch2.pl +++ b/challenge-283/perlboy1967/perl/ch-2.pl |
