1.

Delete a singly linked list. Your task is to complete the method deleteList() which deletes linked list . The function returns 0

Input:

The first line of input contains an integer N denoting the number of elements of the linked list. Then in the next line are N space separated values of the linked list. 

User Task:

The task is to complete the function deleteList() which should delete the node at required position.


Constraints:

1 <= T <= 300

2 <= N <= 100

1 <= x <= N


Example:

Input:


8

2 4 5 6 7 1 9 0
 

2.

Given two integer arrays of same size, “arr[]” and “index[]”, reorder elements in “arr[]” according to given index array. It is not allowed to given array arr’s length.

Example: 
Input:  arr[]   = [10, 11, 12];
        index[] = [1, 0, 2];
Output: arr[]   = [11, 10, 12]
        index[] = [0,  1,  2] 
Input:  arr[]   = [50, 40, 70, 60, 90]
        index[] = [3,  0,  4,  1,  2]
Output: arr[]   = [40, 60, 90, 50, 70]
        index[] = [0,  1,  2,  3,   4]

Expected time complexity O(n) and auxiliary space O(1)

3.

Given a singly linked list. The task is to find the length of the linked list, where length is defined as the number of nodes in the linked list.

Example 1:

Input:
8
2 4 5 6 7 1 9 0
Output: 8
Explanation: Count of nodes in the 
linked list is 8, which is its length.

Example 2:

Input:
5
3 4 5 7 3
Output: 5
Explanation: Count of nodes in the
linked list is 5. Hence, the output
is 5.

Your Task:
Your task is to complete the given function getCount(), which takes a head reference as an argument and should return the length of the linked list.

Expected Time Complexity : O(N)
Expected Auxilliary Space : O(1)

Constraints:
1 <= N <= 105
1 <= value <= 103

4.
Write a function that searches a given key ‘x’ in a given singly linked list. The function should return true if x is present in linked list and false otherwise. 

For example, if the key to be searched is 15 and linked list is 14->21->11->30->10, then function should return false. If key to be searched is 14, then the function should return true.
5.

Given an array, rotate the array by one position in clock-wise direction.
 

Example 1:
Input:
N = 5
A[] = {1, 2, 3, 4, 5}
Output:
5 1 2 3 4
 
Example 2:
Input:
N = 8
A[] = {9, 8, 7, 6, 4, 2, 1, 3}
Output:
3 9 8 7 6 4 2 1

 

Your Task:  
You don't need to read input or print anything. Your task is to complete the function rotate() which takes the array A[] and its size as inputs and modify the array.

 

Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

 

Constraints:
1<=N<=105
0<=a[i]<=105