DATA STRUCTURE


vinaykhatri
Vinay Khatri 16 October, 2021

Replace Every Array Element With The Product of Every Other Element

Problem Given an integer array nums, return an array res such that  res[i] is equal to the …

vinaykhatri
Vinay Khatri 16 October, 2021

Longest? ?Bitonic? ?Subarray? ?Problem? ?

Problem An array arr is a bitonic array if and only if: arr.length >= 3 AND There exists…

vinaykhatri
Vinay Khatri 2 October, 2021

Program to Rotate an Array

You are given an array. Rotate the array clockwise. Examples:  Input:  arr[] = {1…

vinaykhatri
Vinay Khatri 2 October, 2021

Maximum of all Subarrays of size K (Sliding Window Maximum)

We have been given an integer array of size ‘n’ and an integer ‘k’, we need…

vinaykhatri
Vinay Khatri 2 October, 2021

Print a given matrix in spiral form

You are given a matrix of integers, you need to print the matrix in spiral form. For Example: Consi…

vinaykhatri
Vinay Khatri 2 October, 2021

Rod Cutting Problem - Dynamic Programming

Problem Statement Given a rod of length “n” inches and an array of prices consisting…

vinaykhatri
Vinay Khatri 2 October, 2021

Find whether an array is subset of another array

Problem Statement Consider two arrays, array1 and array2. These arrays can contain both positive…

vinaykhatri
Vinay Khatri 2 October, 2021

Rearrange an array in maximum minimum form

You are given a sorted array as the input. You have to rearrange the array in such a manner that al…

vinaykhatri
Vinay Khatri 2 October, 2021

Print all subarrays with 0 sum

Problem Statement: We need to find the subarrays with a sum having exactly 0. A subarray is a co…

vinaykhatri
Vinay Khatri 2 October, 2021

Longest subarray with sum as K

Problem statement Given an n-dimensional array of integers, arr[]. The task is to determine the …

vinaykhatri
Vinay Khatri 2 October, 2021

Merge Two Sorted Arrays in-place

Problem Two integer arrays nums1 and nums2 are sorted in non-decreasing order, and two integers …

vinaykhatri
Vinay Khatri 1 October, 2021

Sort binary array in linear time

We have given a binary array (contains one 1s and 0s), and we need to write a logic that can sort t…