# Archive for January 2017

Problem statement Identify whether there exists a pair of numbers in an array such that their sum is equal to . Input The first line contains one integer , which is the sum we are trying to find. The second line contains one integer , which is the length of . . . Read more

Problem statement Identify whether four sides (given by four integers) can form a square, a rectangle, or neither. Input You will receive an list of strings, each containing four space-separated integers, which represent the length of the sides of a polygon. The input lines will follow the ‘A B C . . . Read more

Problem statement Given the root of a Binary Search Tree (BST), convert the BST to a sorted doubly linked list in-place. BST is formed only on left and right pointers. prev and next pointers are unassigned initially. Initialise prev and next pointers of Node for creating a doubly-linked list. BST . . . Read more

Problem statement Given an array of elements, find the maximum possible sum of a 1. Contiguous subarray 2. Non-contiguous (not necessarily contiguous) subarray. Empty subarrays/subsequences should not be considered. Input Format First line of the input has an integer . cases follow. Each test case begins with an integer . . . . Read more

Assuming you have an OpenShift account go ahead and login. Otherwise create an account first. Next, login to OpenShift’s web console, create a new Node.js application by clicking on Add Application… and then selecting Node.js 0.10. Fill out the fields such as Public URL (e.g. testnode) and leave the rest . . . Read more

You are responsible for auditing all customer orders. Each order has a price, , and a timestamp, , denoting the minute when it was received. At any given time, your manager can ask you for the maximum price of any order placed within the last minutes. For example, if your . . . Read more

Problem statement There are bikers present in a city (shaped as a grid) having bikes. All the bikers want to participate in the HackerRace competition, but unfortunately only bikers can be accommodated in the race. Jack is organizing the HackerRace and wants to start the race as soon as possible. . . . Read more

In the last post I have talked about the problem of finding the maximum flow in a graph, and how it can be solved using the Ford-Fulkerson algorithm. In this short post I will demonstrate how this can be applied to a real world problem. But lets first bring in . . . Read more