Home Practice Programming

# Practice Programming

### Find subarray with given sum (Non-negative Numbers)

Given a non-negative subarray of size n, we have to find the index of subarrays such that their sum is equal to the given...

### Count the number of islands

Given a binary 2D matrix, containing the combination of 1's and 0's, where 0's represents the water and 1's represent the land. Our task...

### Count all possible paths between two vertices of a directed graph

Given a directed graph G, and two vertices: start s & end e, count all possible way of reaching the vertex e from vertex...

### Minimum number of swaps required to sort a given array

Problem Statement: Given an array of n distinct elements, we have to find the minimum number of swaps required to sort the given array. Example...

### Detect Cycle in a Directed Graph

We are given a directed graph with V vertices and we have to find whether this directed graph contains a cycle or not. A cycle...

### Maximize the number of cut segments of length x, y and z

We are given a rod of length L, our task is to cut the rod into segments of x, y & z such that...

### Wildcard Pattern Matching using Dynamic Programming

Wildcard Pattern Matching - Given a text of length n and a wildcard pattern of length m, we are supposed to find whether the...

### Largest Rectangular Area in a given Histogram

Given a histogram find the largest rectangle (rectangular area) that can be made out of the number of contiguous bars, assuming that every bar...

### Find whether a given array is a subset of another array

We are given two arrays, arr1 and arr2, that contains n, m number of distinct elements in unsorted order. We are supposed to find,...

### Find all triplets such that sum of two equals to third element

We are given an array of n distinct integers and we have to find all triplets (3 elements), such that the sum of two...