Shift all matrix elements by 1 in spiral order

Shift all matrix elements by 1 in spiral order

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

Print Matrix in Spiral Form

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

Job Sequencing Problem

Job Sequencing Problem

Problem Given a set of jobs, each with its own deadline and corresponding profit. You get profit…

Activity Selection Problem

Activity Selection Problem

Problem Given pairs of integers denoting starting and ending time of each task. Find maximum num…

Left Rotate an Array

Left Rotate an Array

Problem Given an array of integers, you need to rotate it by k times. Sample Input [1, 2…

Find the sorted triplet in an array

Find the sorted triplet in an array

Problem Given an integer array arr, find a sorted triplet such that arr[i] < arr[j] < arr[…

Rearrange an array such that it contains alternate positive and negative numbers

Rearrange an array such that it contains alternate positive and negative numbers

Problem You are given an array, rearrange the elements such that positive and negative integers …

Efficiently calculate the frequency of all elements present in a limited range array

Efficiently calculate the frequency of all elements present in a limited range array

Problem Given an array of size nwhere elements range from 0 to n-1. Calculate frequency of each …

Find the index that divides an array into two non-empty subarrays with equal sum

Find the index that divides an array into two non-empty subarrays with equal sum

Problem Given an integer array, find an index that divides it into two non-empty subarrays havin…

Find subarrays with a given sum in an array

Find subarrays with a given sum in an array

Problem Given an unsorted array of nonnegative integers, find a continuous subarray which adds t…

Count distinct absolute values in a sorted array

Count distinct absolute values in a sorted array

Problem Given a sorted array of integers, return the number of distinct absolute values among th…

Find minimum product among all combinations of triplets in an array

Find minimum product among all combinations of triplets in an array

Problem Find minimum product of any three triplets in an array Sample Input [1, 2, 3, 4]…