Posts

Showing posts from September, 2021

Minimum indexed character

  Easy Accuracy: 50.58% Submissions: 21507 Points: 2 Given a string  str  and another string  patt . Find the first position (considering 0-based indexing) of the character in  patt  that is present at the minimum index in  str . Example 1: Input: str = geeksforgeeks patt = set Output: 1 Explanation: e is the character which is present in given patt "geeksforgeeks" and is first found in str "set". First Position of e in str is 1. Example 2: Input: str = adcffaet patt = onkl Output: -1 Explanation: There are none of the characters which is common in patt and str. Your Task: You only need to complete the function minIndexChar()  that returns the index of answer in str or returns -1 in case no character of patt is prese

Right most non zero digit

Right most non zero digit Easy Accuracy: 39.12% Submissions: 8042 Points: 2 You will be given an array A of N non-negative integers. Your task is to find the rightmost non-zero digit in the product of array elements. Example 1: Input: N = 4, A = {3, 23, 30, 45} Output: 5 Explanation: Product of these numbers are 93150. Rightmost non-zero digit is 5. Example 2: Input: N = 5, A = {1, 2, 3, 4, 5} Output: 2 Explanation: Product of these numbers are 120. Rightmost non-zero digit is 2. Your