# Category: Groupon

## Reverse a Linked List in groups of given size ‘K’

Objec­tive: Given a linked list and inte­ger ‘k’, write an algo­rithm to reverse the linked list in groups of size ‘k’. Exam­ple: Approach: Ear­lier we have seen how to reverse a linked list, solu­tion for…

## Dynamic Programming — Longest Palindromic Subsequence

Objec­tive: Given a string, find a longest palin­dromic sub­se­quence in it. What is Longest Palin­dromic Sub­se­quence: A longest palin­dromic sub­se­quence is a sequence that appears in the same rel­a­tive order, but not nec­es­sar­ily contiguous(not substring)…

## Reverse Level Order Traversal

Objec­tive: — Given a binary tree, Do the reverse level order tra­ver­sal. In our ear­lier post we have seen nor­mal Level Order Tra­ver­sal. In reverse level order tra­ver­sal we first need to print the…

## Swap Kth Node from the front with the Kth Node from the End

Objec­tive: Given a Linked List and a num­ber k, Swap Kth Node from the front with the Kth Node from the End Exam­ple: ->10->20->30->40->50->60->70 Swap­ping 1 Node from the Front and from the End ->70->20->30->40->50->60->10…

## Construct a binary tree from given Inorder and Postorder Traversal

Objec­tive: — Given a inorder and pos­torder tra­ver­sal, write an algo­rithm to con­struct a binary tree from that. This prob­lem was asked in the Microsoft cod­ing com­pe­ti­tion. Input: Inorder and pos­torder tra­ver­sals Sim­i­lar Problems:…

## BST) or not">Determine whether given binary tree is binary search tree(BST) or not

Objec­tive: Given a Binary tree, find out whether its binary search tree or not. Input: A Binary Tree. Out­put: True or false based on whether tree is BST ot not. Approach: Method 1 : If tree…