DATA STRUCTURE


vinaykhatri
Vinay Khatri 28 September, 2021

Longest Palindromic Subsequence using Dynamic Programming

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

vinaykhatri
Vinay Khatri 5 August, 2021

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…

vinaykhatri
Vinay Khatri 5 August, 2021

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

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

vinaykhatri
Vinay Khatri 5 August, 2021

Maximum Product Subarray

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

vinaykhatri
Vinay Khatri 2 July, 2021

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]<…

vinaykhatri
Vinay Khatri 2 July, 2021

Construct a Binary Tree from Inorder and Preorder traversals

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

vinaykhatri
Vinay Khatri 2 July, 2021

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…

vinaykhatri
Vinay Khatri 2 July, 2021

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 …

vinaykhatri
Vinay Khatri 2 July, 2021

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…

vinaykhatri
Vinay Khatri 2 July, 2021

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 …

vinaykhatri
Vinay Khatri 2 July, 2021

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…

vinaykhatri
Vinay Khatri 2 July, 2021

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…