Tag Archives: sieve

Given an array arr[] consisting of N positive integers, the task is to find the sum of factors of product of all array elements. Since… Read More
Given two positive integers N and X, the task is to find the smallest divisor of N which is closest to X. Examples: Input: N… Read More
Given an array arr[] consisting of N positive integers and integers L and R, the task is to find the count of numbers in the… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to count the number of array elements having exactly K… Read More
Given string str of length N, the task is to remove all the characters from the string whose frequencies are prime. Examples: Input: str =… Read More
Given an array arr[] consisting of N non-negative integers, the task is to count the number of array elements whose product of digits is a… Read More
Given two integers L and R, the task is to count the number of pairs from the range [L, R] whose sum is a prime… Read More
Given an integer N, the task is to count the number of pairs of prime numbers in the range [1, N] such that the difference… Read More
Given an array arr[] of size N, the task is to find the composite Fibonacci numbers present in the given array. Examples: Input: arr[] =… Read More
Given two integers L, R, and an integer K, the task is to print all the pairs of Prime Numbers from the given range whose… Read More
Given a 2D array Q[][] of size N * 2 representing queries of the form {L, R}. For each query, the task is to print… Read More
Given two integers L and R, the task is to count all the numbers in the range [L, R] whose sum of digits is a… Read More
Given an array arr[] of size N, the task is to find the maximum sum of a subsequence formed by concatenating disjoint subarrays whose lengths… Read More
Given an array arr[] consisting of non-negative integers, the task is to print the length of the longest subsequence from the given array whose sum… Read More
Given an integer N, the task is to find the number of ways N! can be split into two distinct factors A and B such… Read More