DATA STRUCTURE


Longest Palindromic Subsequence using Dynamic Programming

Longest Palindromic Subsequence using Dynamic Programming

Problem Statement You are given a String ‘S’ of a certain length, your task is to fi…

Find all distinct combinations of a given length

Find all distinct combinations of a given length

Problem Given two integers n and k, return all possible combinations of k numbers out of the ran…

Find Maximum Sequence of Continuous 1s Formed by Replacing at-most ‘k’ 0s by 1s

Find Maximum Sequence of Continuous 1s Formed by Replacing at-most ‘k’ 0s by 1s

Problem Given a binary array and an integer k, return the maximum number of consecutive 1's …

Maximum Product Subarray

Maximum Product Subarray

Problem Given an integer array nums, find a contiguous non-empty subarray within the array that …

Rearrange an array such that arr[i] = i

Rearrange an array such that arr[i] = i

We have been given an integer array of size n, where every element a[i] is such that, 0<=a[i]<…

Construct a Binary Tree from Inorder and Preorder traversals

Construct a Binary Tree from Inorder and Preorder traversals

You are given inorder and preorder traversals. Create a Binary Tree using these given traversals. …

Construct a tree from Inorder and Level order traversals

Construct a tree from Inorder and Level order traversals

You are given inorder and level order traversals. Create a Binary Tree using these given traversals…

Find the Maximum Product of Two Integers in an Array

Find the Maximum Product of Two Integers in an Array

Problem Statement We have given an integer array and we need to find two numbers from the array …

Move all zeros present in an array to the end

Move all zeros present in an array to the end

We have given an integer array, and we need to move all the zeros present in it to the end. And the…

Sort an array in one swap whose two elements are swapped

Sort an array in one swap whose two elements are swapped

Problem Statement We have given an array in which all elements are sorted except two. Those two …

Program to Find LCM and HCF of two numbers

Program to Find LCM and HCF of two numbers

LCM stands for Least Common Multiple, and HCF stands for Highest common factor. Finding LCM and HCF…

Program to Convert Given Inches into Equivalent Yards and Feet

Program to Convert Given Inches into Equivalent Yards and Feet

A unit is a known quantity used in measurement. Unit conversion is the process of converting one un…