Posts

Showing posts from March, 2021

problem no 62:(problem on array):wave array.

problem:

problem no 61:(problem on strings):Check if strings are rotations of each other or not

 problem: Check if strings are rotations of each other or not Basic Accuracy: 49.96% Submissions: 13329 Points: 1 Given two strings s1 and s2. The task is to check if s2 is a rotated version of the string s1. The characters in the strings are in lowercase.

problem no 60:(problem on the matrix):printing the matrix in snake pattern

Image
 problem: Print Matrix in snake Pattern Basic Accuracy: 72.32% Submissions: 6635 Points: 1 Given a  matrix  of size N x N . Print the elements of the matrix in the snake like pattern depicted below. Example 1: Input : N = 3 matrix[][] = {{45, 48, 54},   {21, 89, 87}   {70, 78, 15}} Output : 45 48 54 87 89 21 70 78 15  Explanation : Matrix is as below: 45 48 54 21 89 87 70 78 15 Printing it in snake pattern will lead to the output as 45 48 54 87 89 21 70 78 15. Example 2: ...

problem no 59:(problem on the matrix): find the transpose of the matrix.

 problem:  

problem no 58:(problem on string):Non Repeating Character .

 QUESTION: Given a string S consisting of lowercase Latin Letters. Find the first non-repeating character in S. Example 1: Input: S = hello Output: h Explanation: In the given string, the first character which is non-repeating is h, as it appears first and there is no other ' h ' in the string. Example 2: Input: S = zxvczbtxyzvy Output: c Explanation: In the given string, 'c' is the character which is non-repeating.   

problem no 57:(problem on hashmap):find the majority element inside the array.

QUESTION: Majority Element Easy Accuracy: 48.6% Submissions: 36991 Points: 2 Given an array A of N elements. Find the majority element in the array. A majority element in an array A of size N is an element that appears more than N/2 times in the array .   Example 1: Input: N = 3 A[] = {1,2,3} Output: -1 Explanation: Since, each element in {1,2,3} appears only once so there is no majority element. Example 2: Input: N = 5 A[] = {3,1,3,3,2} Output: 3 Explanation: Since, 3 is present more than N/2 times, so i...

problem no 56:(problem on Strings):Given two strings A and B. Find the characters that are not common in the two strings.

 QUESTION: Uncommon characters Basic Accuracy: 30.87% Submissions: 2461 Points: 1 Given two strings A and B. Find the characters that are not common in the two strings.  Example 1: Input: A = geeksforgeeks B = geeksquiz Output: fioqruz Explanation: The characters 'f', 'i', 'o', 'q', 'r', 'u','z' are either present in A or B, but not in both. Example 2: Input: A = characters B = alphabets Output: bclpr Explanation: The characters 'b','c','l',...

problem no 55: (problem on array):Leaders in an array.

QUESTION: Leaders in an array Easy Accuracy: 49.96% Submissions: 41276 Points: 2 Given an array A of positive integers. Your task is to find the leaders in the array. An element of array is leader if it is greater than or equal to all the elements to its right side. The rightmost element is always a leader.    Example 1: Input: n = 6 A[] = {16,17,4,3,5,2} Output: 17 5 2 Explanation: The first leader is 17 as it is greater than all the elements to its right.  Similarly, the next leader is 5. The right mo...