Looking for good programming challenges?

Use the search below to find our solutions for selected questions!

Archive for January 2017

Sum of 2 numbers in an array

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

Polygons challenge

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

Binary Search Tree to sorted doubly-linked list

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

The maximum continuous and non-continuous subarray challenge

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

Deploy a Node.js app to OpenShift from a private GitHub repository

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

The inquiring manager challenge

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

Bike racers challenge

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

Maximum bipartite matching

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