Date of visit: 18.7.2018
Criteria: CGPA 7 above no current Arrear
Platform: cocubes
Duration: 1.15 mins
Overview:
There were three questions in total. There were some three to four question sets with the problems shuffled. Each set consisted of a 2 marks question, 3 marks question and 5 marks question.
Questions:
SET -1
1. Word average: Given a word as input you have to find the average of the word. It is calculated by the ascii values all the characters present divided by the total number of characters.
Sample Input: source
Sample Output: 109.5
Explanation:
Ascii value of s is 115
Ascii value of o is 111
Ascii value of u is 117
Ascii value of r is 114
Ascii value of c is 99
Ascii value of e is 101
Total = 657
Average = total / string_length = 657 / 6 = 109.5
2. Given a linked list, write a function to reverse every k nodes (where k is an input to the function).
3. Find the sum for all the cousins of a given node in a tree. A cousin of a node is the node which is present in the same level as given node but having different parents.
Similar problem – printing cousins link
SET - 2
1. Given two input arrays find the sum of uncommon elements.
similar problem solution
2. Given a number, find the next smallest palindrome larger than this number. For example, if the input number is “2 3 5 4 5”, the output should be “2 3 6 3 2”. And if the input number is “9 9 9”, the output should be “1 0 0 1”.
solution link
3. Given a cost matrix cost[][] and a position (m, n) in cost[][], write a function that returns cost of minimum cost path to reach (m, n) from (0, 0).
solution link
Questions in other sets:
1. Binary strings without consecutive set bits
solution link
Criteria: CGPA 7 above no current Arrear
Platform: cocubes
Duration: 1.15 mins
Overview:
There were three questions in total. There were some three to four question sets with the problems shuffled. Each set consisted of a 2 marks question, 3 marks question and 5 marks question.
Questions:
SET -1
1. Word average: Given a word as input you have to find the average of the word. It is calculated by the ascii values all the characters present divided by the total number of characters.
Sample Input: source
Sample Output: 109.5
Explanation:
Ascii value of s is 115
Ascii value of o is 111
Ascii value of u is 117
Ascii value of r is 114
Ascii value of c is 99
Ascii value of e is 101
Total = 657
Average = total / string_length = 657 / 6 = 109.5
2. Given a linked list, write a function to reverse every k nodes (where k is an input to the function).
Inputs: 1->2->3->4->5->6->7->8->NULL and k = 3
Output: 3->2->1->6->5->4->8->7->NULL.
solution link
3. Find the sum for all the cousins of a given node in a tree. A cousin of a node is the node which is present in the same level as given node but having different parents.
Similar problem – printing cousins link
SET - 2
1. Given two input arrays find the sum of uncommon elements.
similar problem solution
2. Given a number, find the next smallest palindrome larger than this number. For example, if the input number is “2 3 5 4 5”, the output should be “2 3 6 3 2”. And if the input number is “9 9 9”, the output should be “1 0 0 1”.
solution link
3. Given a cost matrix cost[][] and a position (m, n) in cost[][], write a function that returns cost of minimum cost path to reach (m, n) from (0, 0).
solution link
Questions in other sets:
1. Binary strings without consecutive set bits
solution link
I had the same "Word average(2 marks) & Sum of all cousins for a node in a tree(5 marks)" questions as 1st and 3rd and I also had one more question for which the weightage was 3 marks.
ReplyDeleteQue: Given a number which is of string type(i.e.,String num), write the function to return a string that is the next greater palindrome number than the given input "num".
The set which was given to me had the following questions
ReplyDelete1. Sum of uncommon elements in the array - 2marks (Set 2- qn.1)
2. Binary strings without consecutive set bits - 3 marks
(https://www.geeksforgeeks.org/count-number-binary-strings-without-consecutive-1s/)
3. Reorder the given linked list - 5 marks (Set 1- qn.2)