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