## Minimum adjacent swaps required to sort Binary Array in O(n) | Amazon Interview Question

Given an array consisting of only 1s and 0s, sort this binary array such that all 0s are on the left and all 1s are on the right.

## Array Manipulation | HackerRank Solution [Hard]

Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each the array element between two given indices, inclusive. Once all operations have been performed, return the maximum value in the array.

## Sherlock and MiniMax | HackerRank Solution [Hard]

Given an integer range, for all M in that inclusive range, determine the minimum (abs(arr[i]-M) for all
1 <= i <= size[a]

## Sherlock and Array | HackerRank Solution [Easy]

Challenge is to find an element of the array such that the sum of all elements to the left is equal to the sum of all elements to the right

## Max Min | HackerRank Solution [Medium]

Given a list of integers, arr, and a single integer k. Create an array of size k from elements of arr such that its unfairness is minimum

## Count of Maximum Solution

Problem Given an array A of length N, your task is to find the element which repeats in A maximum number of times as well as the corresponding count. In case of ties, choose the smaller element first. Codechef Problem Link Input First line of input contains an integer T, denoting […]

## Jump game – LeetCode Solution [Medium]

Jump game (Leetcode) problem statement:You are given an integer array nums. You are initially positioned at the array’s first index, and each element in the array represents your maximum jump length at that position. Return true if you can reach the last index, or false otherwise. Jump game – Leetcode Example 1: Input: nums = [2,3,1,1,4] Output: […]

## Best Time to Buy and Sell Stock [Interview Question]

Problem Statement [LeetCode]You are given an array prices where prices[i] is the price of a given stock on the ith day. You need to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock. Return the maximum profit you can achieve from this transaction. If you cannot achieve […]

## Convert Sorted Array to Binary Search Tree in C++ – LeetCode Solution [Easy]

Problem Statement Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree. A height-balanced binary tree is a binary tree in which the depth of the two subtrees of every node never differs by more than one. Example 1: Input: nums = [-10,-3,0,5,9] Output: [0,-3,9,-10,null,5] Approach This problem […]

## Array Rotation

Array rotation is a problem of changing the order of the elements of the array. Increasing the index of the element by one and changing the index of the last element to 0 and so on. Problem Statement: Given an array arr[] of size n, rotate it by d elements.  Example […]