## Relative Sort Array Leetcode Solution

In this problem, we are given two arrays of positive integers. All elements of the second array are distinct and are present in the first array. However, the first array can contain duplicate elements or elements that are not in the second array. We need to sort the first array …

## Longest Subarray Having Count of 1s One More than Count of 0s

We have given an array of integers. An array contains 1’s and 0’s only. The problem statement asks to find out the length of the longest Sub-Array which having the quantity of 1’s digit is just one more than the count of 0’s in a sub-array. Example   Input: arr[] = …

## Maximum sum of a path in a Right Number Triangle

The problem “Maximum sum of a path in a Right Number Triangle” states that you are given some integers in the form of a right number triangle. Find out the maximum sum you can achieve if you start from the top and move towards the base such that you move …

## Best Time to Buy and Sell Stock  II Leetcode Solution

Problem statement   In the problem “Best Time to Buy and Sell Stock  II,” we are given an array where each element in the array contains the price of the given stock on that day. The definition of the transaction is buying one share of stock and selling that one share …

## Find if there is a subarray with 0 sum

The problem “Find if there is a subarray with 0 sum” states that you are given an integer array containing negative integers as well. The problem statement asks to determine if any sub-array of size at-least 1. This sub-array should have a sum equal to 1. Example   arr[] = {2,1,-3,4,5} …

## Write a function to get the intersection point of two Linked Lists

Problem Statement   The problem “Write a function to get the intersection point of two Linked Lists” states that you are given two linked lists. But they are not independent linked lists. They are connected at some point. Now you need to find this point of intersection of these two lists. …

## Longest Bitonic Subsequence

Suppose you have an array of integers, the problem statement asks to find out the longest bitonic subsequence. The bitonic sequence of an array is considered as the sequence which first increases and then decreases. Example   arr[] = {1,4,2,76,43,78,54,32,1,56,23} 7 Explanation 1 ⇒ 4 ⇒ 76 ⇒ 78 ⇒ 54 …

## Array Queries for multiply replacements and product

The problem “Array Queries for multiply, replacements and product” states that you are given an array of integer and there will be three types of queries, where you have to solve the following type of queries: Type 1: There will be three values left, right and a number X.In this …

## Constant time range add operation on an array

You have given an integer array and initially, it was initialized as 0 and also given a range. The task is to add the given number in the range of the array and print the resultant array. Example   arr[] = {0, 0, 0, 0, 0} Query: {(0, 2, 50), (3, …

## Queries for counts of array elements with values in given range

Problem Statement   The problem “Queries for counts of array elements with values in given range” states that you have an integer array and two number x and y. The problem statement asks to find out the count of numbers present in array that lies between the given x and y. …