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:

Input:
N = 2
matrix[][] = {{1, 2},
              {3, 4}}
Output: 1 2 4 3
Explanation:
Matrix is as below:
1 2 
3 4
Printing it in snake pattern will
give output as 1 2 4 3.


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

2.

Given a non null integer matrix Grid of dimensions NxM.Calculate the sum of its elements.

Example 1:

Input:
N=2,M=3
Grid=
[[1,0,1],
[-8,9,-2]]
Output:
1
Explanation:
The sum of all elements of the matrix is
(1+0+1-8+9-2)=1.

Example 2:

Input:
N=3,M=5
Grid=
[[1,0,1,0,1],
[0,1,0,1,0],
[-1,-1,-1,-1,-1]]
Output:
0
Explanation:
The sum of all elements of the matrix are
(1+0+1+0+1+0+1+0+1+0-1-1-1-1-1)=0.



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

3.

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:

Input:
L = 10
R = 20
Output:
10 12 13 14 15 16 17 18 19 20
Explanation:
The number 11 has two 1 therefore
11 is not a unique number.

Example 2:

Input:
L = 1
R = 9
Output:
1 2 3 4 5 6 7 8 9
Explanation:
All the Numbers are unique.

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