Hoarding programming problems for you!

Looking for good programming challenges?

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

All posts tagged interview

Sort hotel list challenge

Problem statement Given a set of hotels and its guests reviews, sort the hotels based on a list of words specified by a user. The criteria to sort the hotels should be how many times the words specified by the user is mentioned in the hotel reviews. Input The first . . . Read more

Delta encoding challenge

Problem statement Given a list of numbers, e.g.:

Output a delta encoding for the sequence. In a delta encoding, the first element is reproduced as is. Each subsequent element is represented as the numeric difference from the element before it. E.g. for the sequence above, the delta encoding would . . . Read more

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

Pots of gold

Problem statement Pots of gold game: Two players and . There are pots of gold arranged in a line, each containing some gold coins (the players can see how many coins are there in each gold pot – perfect information). They get alternating turns in which the player can pick . . . Read more

Get minimum time difference challenge

Problem statement Given an array of times in HH:MM format, find the minimum difference in minutes. The time is circular in nature. For example 23:52 and 00:08 have a difference of 16. Also 00:00 should be handled the same as 24:00. Solution The first key is to convert the string . . . Read more

SimpleUTF8 reverse challenge

Problem statement Consider the SimpleUTF8 format that consists of characters of the following length: – 1 byte which have the format 0XXXXXXX – 2 bytes which have the format 110XXXXX 10XXXXXX – 3 bytes which have the format 1110XXXX 10XXXXXX 10XXXXXX You will receive a byte[] str. Your task is . . . Read more

The Celebrity problem

Problem statement In a party of people, only one person is known to everyone (celebrity). That celebrity doesn’t know anyone in the party. Find the celebrity if such a person exist. Input Format The first line of the input will contain ( the number of people) and . Each of . . . Read more