diff options
| author | boblied <boblied@gmail.com> | 2020-08-26 17:21:43 -0500 |
|---|---|---|
| committer | boblied <boblied@gmail.com> | 2020-08-26 17:21:43 -0500 |
| commit | 3e8f3db647754ea702c9efe149026c4a8d88b460 (patch) | |
| tree | e2b917a9da388183787b59ce3b80ded14522f7c8 /challenge-075 | |
| parent | 423b552b8547f4125749ae062ca5e73a64dbc931 (diff) | |
| download | perlweeklychallenge-club-3e8f3db647754ea702c9efe149026c4a8d88b460.tar.gz perlweeklychallenge-club-3e8f3db647754ea702c9efe149026c4a8d88b460.tar.bz2 perlweeklychallenge-club-3e8f3db647754ea702c9efe149026c4a8d88b460.zip | |
Update README
Diffstat (limited to 'challenge-075')
| -rw-r--r-- | challenge-075/bob-lied/README | 54 |
1 files changed, 2 insertions, 52 deletions
diff --git a/challenge-075/bob-lied/README b/challenge-075/bob-lied/README index e3712fbb10..b4b27d55df 100644 --- a/challenge-075/bob-lied/README +++ b/challenge-075/bob-lied/README @@ -1,53 +1,3 @@ -Solutions to weekly challenge 74 by Bob Lied. +Solutions to weekly challenge 75 by Bob Lied. -https://perlweeklychallenge.org/blog/perl-weekly-challenge-074/ - -* TASK #1 > Majority Element - -** Initial thoughts - -This is going to be an exercise in hashes and grep. - -** Post Solution Thoughts - -Use a hash to count to count elements, then use grep with a code block to select the match. - -** Problem Statement - -You are given an array of integers of size $N. -Write a script to find the majority element. If none found then print -1. -Majority element in the list is the one that appears more than floor(size_of_list/2). - - - -* TASK #2 > FNR Character - -** Initial Thoughts - -The specification is a little odd and doesn't match the example. But, OK, whatever. -Similar to the first task, another hash to count occurrences and grep to find the answers. - -** Post Solution Thoughts - -Going through the string could be either done with substr one character at a time, -or splitting the string into an array of characters. Finding the first char could be -a search through the character positions, or a sort and picking off the first element. -Sort is the easy answer, but I'm always wary of scaling. Like in many of these -problems, it's not an issue for "reasonable" strings, but could become a performance -question if the strings were a thousand or a million times bigger. - - -** Problem Statement - -You are given a string $S. - -Write a script to print the series of first non-repeating character -(left -> right) for the given string. Print # if none found. -Example 1 -Input: $S = ‘ababc’ -Output: ‘abb#c’ -Pass 1: “a”, the FNR character is ‘a’ -Pass 2: “ab”, the FNR character is ‘b’ -Pass 3: “aba”, the FNR character is ‘b’ -Pass 4: “abab”, no FNR found, hence ‘#’ -Pass 5: “ababc” the FNR character is ‘c’ +https://perlweeklychallenge.org/blog/perl-weekly-challenge-075/ |
