Tag Archives: number-theory

Given an array arr[] of size N, the task is to maximize the count of distinct array elements by repeatedly inserting absolute difference between all… Read More
Given a list arr[] consisting of arrays of varying lengths, the task is to find the maximum product that can be formed by taking exactly… 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 integer N and an array arr[], the task is to check if a sequence of first N natural numbers, i.e. {1, 2, 3,… Read More
Given two positive integers P and Q, the task is to largest divisor of P which is not divisible by Q. Examples: Input: P =… Read More
Given integer N and integer S, the task is to find the smallest number greater than or equal to N such that the sum of… Read More
Given an integer N which needs to be present as a value in a node in the last level of a Tree rooted at 1… Read More
Given three integers A, B and C, the task is to find the value of the expression  Since the answer can be very large, print… Read More
Given an array arr[] of size N, the task is to count the number of pairs from the given array whose product contains only a… Read More
Given an integer N representing a non-linear equation of the form 2X + 5Y = N, the task is to find an integral pair (X,… 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 two numbers A and B, the task is to find the minimum number that needs to be added to A and B such that… Read More
Given an integer N, the task is to reduce N to 1 by minimum number of operations involving multiplication by 2 and division by 10.… Read More
Given an array arr[], the task is to count the number of unordered pairs (arr[i], arr[j]) from the given array such that (arr[i] * arr[j])… Read More