# DATA STRUCTURE

## Print Matrix in Spiral Form

Problem Given an integer matrix, print it in spiral form Sample Input [1 2 3 4] [4 5 6 …

## Shift all matrix elements by 1 in spiral order

Problem Given an M x N matrix, shift all its elements by 1 in spiral order Sample Input …

## Maximum Units

Problem You have to place a number of boxes into the truck. You are given a 2D array where each …

## Missing Numbers

Problem Given an integer array in which all numbers occur twice except 2. Find those two numbers…

## Monotonic Array

Problem Given an array. Check if it is monotonic increasing or decreasing. An array is monotonic…

## Binary Gap

Problem Given an integer ‘n’, find the maximum gap between two occurrences of 1. If …

## Arranging coins

Problem We've been given ‘n’ coins, and you're supposed to use them to build…

## Pass by Reference vs Pass by Pointer in C++

Pass by reference and pass by pointer are the two popular ways of passing variables to a function i…

## Find a pair with a minimum absolute difference in an array

Problem Given an unsorted array, find the minimum difference between any pair in a given array a…

## Find two non-overlapping pairs having the same sum in an array

Problem Given an unsorted array of integers. The task is to find any two non-overlapping pairs w…

## Find triplet having maximum product in an array

Problem Find 3 numbers from the array such that their product is maximum. Sample Input […

## Check if one string can be made another by swapping at most once

Problem Given two strings A and B, check if A can be made equal to B by swapping two characters …