Given an array of integers arr[] of size N and an integer K, the task is to find the smallest prime such that it gives… Read More
Tag Archives: LCM
Given two strings str1 and str2 of lengths N and M respectively. The task is to find the least common multiple (LCM) of both the… Read More
Given two positive integers L and R representing a range. The task is to find the minimum and maximum possible LCM of any pair (i,… Read More
Given an array arr[] consisting of N positive integers, the task is to find the minimum possible length of a rod that can be cut… Read More
Given two strings S and T of length N and M respectively, the task is to find the smallest string that is divisible by both… Read More
Given an array arr[] of size N, the task is to count the number of pairs having even LCM and odd LCM. Examples: Input: arr[]… Read More
Given a positive integer N, the task is to find the smallest integer greater than or equal to X, having all its digits divisible by… Read More
Given L, B, and H which denotes the length, breadth, and height of a cuboid, the task is to find the minimum number of cuboids… Read More
Given two integers N and M, the task is to find their LCM using recursion. Examples: Input: N = 2, M = 4Output: 4Explanation: LCM… Read More
Given a positive integer N, the task is to construct the longest sorted sequence of unique elements whose LCM of the is equal to N.… 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 count the total number of ordered pairs such that the LCM of each pair is equal to… Read More
Given an array arr[] consisting of N positive integers, the task is to find the minimum number of pairs (arr[i], arr[j]) from the given array… Read More
Given two integers L and R, the task is to find a pair of integers from the range [L, R] having LCM within the range… Read More
Given two numbers L and R, the task is to find two distinct minimum positive integers X and Y such that whose LCM lies in… Read More