Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers that has the largest sum....
Given a singly linked list, find the middle of the linked list. For example, if the given linked list is 1->2->3->4->5 then the output should be 3. If there are even nodes, then there would be two middle nodes, we need to print the second middle element. For example, if given linked list is 1->2->3->4->5->6 then the output should be 4....
Given a set of strings, find the longest common prefix. Examples:...
Given a linked list, write a function to reverse every k nodes (where k is an input to the function)....
Given K sorted linked lists of size N each, merge them and print the sorted output....
Given a linked list, write a function to reverse every k nodes (where k is an input to the function). Examples:...
Given k linked lists each of size n and each list is sorted in non-decreasing order, merge them into a single sorted (non-decreasing order) linked list and print the sorted linked list as output.Examples:...
A Binary Search Tree (BST) is a node-based binary tree data structure that has the following properties....
Given a Singly Linked List, the task is to find the middle of the linked list. If the number of nodes are even, then there would be two middle nodes, so return the second middle node....
Design a Data Structure SpecialStack that supports all the stack operations like push(), pop(), isEmpty(), isFull() and an additional operation getMin() which should return minimum element from the SpecialStack. All these operations of SpecialStack must have a time and space complexity of O(1). Note: To implement SpecialStack, you should only use standard Stack data structure and no other data structure like arrays, lists, etc...
Given a linked list, write a function to reverse every k node (where k is an input to the function)....