DATA STRUCTURE


Replace Every Array Element With The Product of Every Other Element

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 …

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

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

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

Program to Rotate an Array

Program to Rotate an Array

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

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

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…

Print a given matrix in spiral form

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…

Rod Cutting Problem - Dynamic Programming

Rod Cutting Problem - Dynamic Programming

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

Find whether an array is subset of another array

Find whether an array is subset of another array

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

Rearrange an array in maximum minimum form

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…

Print all subarrays with 0 sum

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…

Longest subarray with sum as K

Longest subarray with sum as K

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

Merge Two Sorted Arrays in-place

Merge Two Sorted Arrays in-place

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

Sort binary array in linear time

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…