Question: Find the missing number in the list containing natural numhers to N+1 Description of input data: 1. List A contains all natural numbers except one and is of length N - [1,..,(N+1)] 2. All elemnts in A are distinct Eample: Input List: A = [2,3,1,5], N=4 Output: 4 Logic: One way to do it is to sort the list A. Then compare the sorted list with incrementing numbers. There is an elegant way to do this with a little more mathematics involved. We know the sum of first n natural numbers is n(n+1)/2. It is given that all elements of the are distinct, that is they appear only once in that list. Input list A contains all natural numbers ad has one number missing. If we subtract the the sum of elements in the list from the sum of N natural numbers we will get the number that is missing in the list. Pseudo code: Method 1: 1. Sort the list. Compare length of the list to the max value on the list. 2. if len(A)==max(A) then the missing number is N+1,
Question: Given a list of length N, print the elements of the list A after K right cyclic rotations Description of Input Data: 1. N,K are integers in the range of [0,100] 2. Elements in A lie in the range of [-1000,1000] Example: Input Data: A=[3,8,9,7,6], N=5, K=3 Expected output: [9,7,6,3,8] Logic: 1. Elements in the list A need to be reordered according to the value of K and length of list A 2. K elements from the end of the list are the first to appear 3. The remaining elements in the same order are placed after the K elements from the end of the list Psedo Code: 1. Check the length of the input list( length = 0 or length > K or length < 0) 2. If length = 0 output is [] 3. If length > K: then the output is concatination of A[-K:],A[:-K] 4. If length < K: then the output is concatination of A[-(K%length) :], A[: -(K%length)] https://codility.com/programmers/lessons/2-arrays/cyclic_rotation/ Let us use some test cases to unde