Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the … Read More
Array
Hackerearth : Counting Subarrays
Given an array A of N positive integer values. A sub-array of this array is called Odd-Even sub-array if the number of odd integers in this sub-array is equal to the number of even integers … Read More
Sequence Finder Dynamic Programming
Sequence Finder
Given two arrays A and B of equal size, you have to determine whether the following the sequence is possible or not.
Subset Sum Problem Dynamic programming
Problem Statement of Subset Sum Dynamic Programming
Given a set T containing a list of integers and a sum S, does a subset of T exists whose sum is equal to S.
NOTE – Subset … Read More
Maximum sum contiguous subarray of an Array
Given an Array A with n integers both positive and negative, find the maximum sum contiguous subarray within A which has the largest sum
… Read More
N Petrol bunks or City arranged in circle. You have Fuel and distance between petrol bunks. Is it possible to find starting point so that we can travel all Petrol Bunks
Find the first circular tour that visits all petrol pumps
There are n petrol bunks arranged in circle. Each bunk is separated from the rest by a certain distance. You choose some mode of travel
Rectangular chocolate bar Create at least one piece which consists of exactly nTiles tiles
Rectangular chocolate bar Create at least one piece which consists of exactly nTiles tiles.
You have a rectangular chocolate bar that consists of width x height square tiles. You can split it into two rectangular … Read More