## Check given array of size n can represent BST of n levels or not

Problem Statement   Given an array with n elements, check given array of size n can represent BST of n levels or not. That is to check whether the binary search tree constructed using these n elements can represent a BST of n levels. Examples   arr[] = {10, 8, 6, 9, …

## Pair of Positive Negative Values in an Array

In pair of positive negative values in an array problem we have given an array A of distinct integers, print all the pairs having positive value and negative value of a number that exists in the array. We need to print pairs in order of their occurrences. A pair whose …

## Reversing the First K elements of a Queue

In reversing the first K elements of a queue problem we have given a queue and a number k, reverse the first k elements of a queue using standard operations of the queue. Examples   Input: queue = 10 -> 15 -> 31 -> 17 -> 12 -> 19 -> 2 …

## Valid Triangle Number

Problem   In the Valid Triangle Number problem, we have given an array of non-negative integers. Find the number of triplets that can form a triangle. If we consider the numbers in the array as side lengths of the triangle. Example   Input [ 2, 2, 3, 4 ] Output 3 Explanation We …

## Largest Subarray with Equal Number of 0’s and 1’s

Problem Statement   In the “Largest Subarray with Equal Number of 0’s and 1’s” problem, we have given an array a[] containing only 0 and 1. Find the largest subarray with an equal number of 0’s and 1’s and will print the start index and end index of the largest subarray. … 