Given C magnets and an array arr[] representing N index positions where C ≤ N. The task is to place these magnets at these available… Read More

# Tag Archives: Binary Search

Given a spirally sorted matrix with N * N elements and an integer X, the task is to find the position of this given integer… Read More

Given a sorted array, the task is to find the floor and ceil of given numbers using STL. Examples: Input: arr[] = {1, 2, 4,… Read More

Given a Natural number N and a whole number L, the task is to find the count of numbers, smaller than or equal to N,… Read More

Given N candies and K people. In the first turn, the first person gets 1 candy, the second gets 2 candies, and so on till… Read More

Given a number X, the task is to find the minimum number N such that total set bits of all numbers from 1 to n… Read More

Given an array arr[] and an integer K, the task is to count the number of sub-arrays having bitwise OR ≥ K.Examples: Input: arr[] =… Read More

Given an array of size and a number . The task is to modify the given array such that: The difference between the sum of… Read More

Given a string S containing lowercase latin letters. A character c is called K-amazing if every substring of S with length atleast K contains this… Read More

Given an array of N integers where array elements form a strictly decreasing and increasing sequence. The task is to find the smallest number in… Read More

Given an array arr[] of n sorted integer elements and an integer X, the task is to find the lower insertion point of X in… Read More

Given a range represented by two positive integers L and R. The task is to count the numbers from the range having GCD of powers… Read More

Given two positive integers N and K, the task is to count all the numbers that satisfy the following conditions: If the number is num,… Read More

Given a sorted array of String and a String x, find index of x if it is present in the array. Examples: Input : arr[]… Read More

Given an array of integers, find the closest smaller or same element for every element. If all elements are greater for an element, then print… Read More