## Print all the pairs that contains the positive and negative values of an element

Given an array of distinct integers, print all the pairs having a positive value and negative value of a number that exists in the array.… Read More »

## Calculating n-th real root using binary search

Given two number x and n, find n-th root of x. Examples: Input : 5 2 Output : 2.2360679768025875 Input : x = 5, n… Read More »

## Find the only missing number in a sorted array

You are given a sorted array of N integers from 1 to N with one number missing find the missing number Expected time complexity O(logn)… Read More »

## Find index of first occurrence when an unsorted array is sorted

Given an unsorted array and a number x, find index of first occurrence of x when we sort the array. If x is not present,… Read More »

## Binary Search in Java

There are two ways to do binary search in Java. Arrays.binarysearch() works for arrays which can be of primitive data type also. filter_none edit close… Read More »

## Sudo Placement | Range Queries

Given Q queries, with each query consisting of two integers L and R, the task is to find the total numbers between L and R… Read More »

## Check whether the number has only first and last bits set | Set 2

Given a positive integer n, check whether only the first and last bits are set in the binary representation of n. Print ‘Yes’ or ‘No’.… Read More »

## Smallest alphabet greater than a given character

Given a list of sorted characters consisting of both Uppercase and Lowercase Alphabets and a particular target value, say K, the task is to find… Read More »

## Minimum swaps so that binary search can be applied

Given an unsorted array of length n and an integer k, find the minimum swaps to get the position of k before using the binary… Read More »

## Triplets in array with absolute difference less than k

Given an array A[] of n elements and an integer k. The task is to find the number of triplet (x, y, k), where 0… Read More »

Given an array and a value k. We have to find the maximum number of equal elements possible for the array so that we can… Read More »

## Median of two sorted arrays with different sizes in O(log(min(n, m)))

Given two sorted arrays, a[] and b[], task is to find the median of these sorted arrays, in O(log(min(n, m)), when n is the number… Read More »

## Subsets having Sum between A and B

Given a set of N integers. Find how many subsets of given array have sum between A and B(inclusive). Constraints: 1 ≤ 34 ≤ N,… Read More »

## Count smaller elements in sorted array in C++

Given a sorted array and a number x, count smaller elements than x in the given array. Examples: Input : arr[] = {10, 20, 30,… Read More »

## Sum of special triplets having elements from 3 arrays

Given three arrays A, B and C, the task is to find sum of values of all special triplets. A special triplet is defined as… Read More »