Example: Let the input string be “i like this program very much”. The function should change the string to “much very program this like i”...
Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers that has the largest sum....
Given two sorted lists, merge them so as to produce a combined sorted list (without using extra space).Examples:...
In our college campus recruitment process will have an online test (MCQs – 30 min/30Que & Coding Round – 60min duration), followed by technical (2 levels) and personal interview rounds, all Interview sessions conducted virtually. No. of rounds may vary from college to college....
The cost of a stock on each day is given in an array, find the max profit that you can make by buying and selling in those days. For example, if the given array is {100, 180, 260, 310, 40, 535, 695}, the maximum profit can earned by buying on day 0, selling on day 3. Again buy on day 4 and sell on day 6. If the given array of prices is sorted in decreasing order, then profit cannot be earned at all....
Given an array and a value, find if there is a triplet in array whose sum is equal to the given value. If there is such a triplet present in array, then print the triplet and return true. Else return false....
Given a singly linked list of characters, write a function that returns true if the given list is a palindrome, else false....
Given an array of integers, and a number ‘sum’, find the number of pairs of integers in the array whose sum is equal to ‘sum’....
Given a singly linked list, rotate the linked list counter-clockwise by k nodes. Where k is a given positive integer. For example, if the given linked list is 10->20->30->40->50->60 and k is 4, the list should be modified to 50->60->10->20->30->40. Assume that k is smaller than the count of nodes in a linked list....
Merge sort is often preferred for sorting a linked list. The slow random-access performance of a linked list makes some other algorithms (such as quicksort) perform poorly, and others (such as heapsort) completely impossible....
Given a linked list, write a function to reverse every k nodes (where k is an input to the function)....
Given an array of integers, and a number ‘sum’, find the number of pairs of integers in the array whose sum is equal to ‘sum’....