Task 1: "Majority Element You are given an array of integers of size $N. Write a script to find the majority element. If none found then print -1. The majority element in a list is the element, if any, that appears more than floor(size_of_list/2) TIMES. Example 1 Input: @A = (1, 2, 2, 3, 2, 4, 2) Output: 2, as 2 appears 4 times in the list - more than floor(7/2)==3 TIMES. Example 2 Input: @A = (1, 3, 1, 2, 4, 5) Output: -1 as none of the elements appears more than floor(6/2)==3 TIMES. " My notes: ok. Very easy. Task 2: "FNR Character 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' Example 2 Input: $S = 'xyzzyx' Output: 'xyzyx#' Pass 1: 'x', the FNR character is 'x' Pass 2: 'xy', the FNR character is 'y' Pass 3: 'xyz', the FNR character is 'z' Pass 4: 'xyzz', the FNR character is 'y' Pass 5: 'xyzzy', the FNR character is 'x' Pass 6: 'xyzzyx', no FNR found, hence '#' " My notes: why is the FNR of "ab" (in pass 2) 'b' rather than 'a'? Last non-repeating character would be more like it. Basically: in each pass, take substr(1,len PASS) and then remove each LAST char if it's duplicated earlier in the substring, otherwise that's the FNR. If the string is empty, no FNR, print #.