Detail Form
We will send your result on your email id and phone no. please fill detail
Given a matrix of size N x N. Print the elements of the matrix in the snake like pattern depicted below.
Example 1:
Example 2:
Your Task:
You dont need to read input or print anything. Complete the function snakePattern() that takes matrix as input parameter and returns a list of integers in order of the values visited in the snake pattern.
Expected Time Complexity: O(N * N)
Expected Auxiliary Space: O(N * N) for the resultant list only.
Constraints:
1 <= N <= 100
1 <= mat[i][j] <= 100
Given a non null integer matrix Grid of dimensions NxM.Calculate the sum of its elements.
Example 1:
Example 2:
Your Task:
You don't need to read input or print anything.Your task is to complete the function sumOfMatrix() which takes two integers N ,M and a 2D array Grid as input parameters and returns the sum of all the elements of the Grid.
Expected Time Complexity:O(N*M)
Expected Auxillary Space:O(1)
Constraints:
1<=N,M<=1000
-1000<=Grid[i][j]<=1000
In the given range [L, R], print all numbers having unique digits. e.g. In range 10 to 20 should print all numbers except 11.
Example 1:
Example 2:
Your Task:
You don't need to read input or print anything. Your task is to complete the function uniqueNumbers() which takes two integers L and R as an input parameter and returns the list/vector of all the unique numbers present between L to R.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)
Constraints:
1 <= L <= R <= 104
Bheem promised all his friends that if he won the tournament so he will give ladoos. But he knew that he can afford only one ladoo per day. If he is unable to give ladoo to any of his friend he will loose his friendship with them (if more than one his friend demanded for ladoo on same day). As he has won the tournament now he has to give ladoos to his friends. Now your task is to tell how many friends he will be able to save.
Input:
First line consists of T test case.
First line of every test case 'N', represents how many friends he has.
Second line of every test case Ai, represents which friend asked for ladoo on which day.
Output:
For each test case, Single line output denoting how many friends he is able to save.
Constraints:
1<=T<=100
1<=N<=1000
1<=Ai<=1000
Example:
Given a string S of lowercase alphabets, check if it is isogram or not. An Isogram is a string in which no letter occurs more than once.
Example 1:
Example 2:
Your Task:
This is a function problem. You only need to complete the function isIsogram() that takes a string as a parameter and returns either true or false.
Expected Time Complexity: O(N).
Expected Auxiliary Space: O(Number of distinct characters).
Note: N = |S|
Constraints:
1 <= |s| <= 103