Skip to content

Tag Archives: factorial

Given a positive number N, the task is to calculate the factorial of N without using the multiplication operator. Examples: Input: N = 5Output:120Explanation:5*4*3*2*1=120 Input:… Read More
Given an array arr[] consisting of N positive integers, the task is to find the prefix factorials of a prefix sum array of the given… Read More
Given an integer N, the task is to count the number of prime factors of N!. Examples: Input: N = 5Output: 3Explanation: Factorial of 5… Read More
Given three positive integers, L, R, K and an array arr[] consisting of N positive integers, the task is to count the number of ways… Read More
Given an integer N, the task is to count the numbers less than or equal to N such that each number contains at least one… Read More
A factorial is positive integer n, and denoted by n!. Then the product of all positive integers less than or equal to n. For example:… Read More
Given N distinct objects, the task is to find the number of distinct arrangements of N objects if all clockwise arrangements are considered the same.… Read More
Given an integer N, the task is to count the total number of unimodal and non-unimodal permutations of integers [1, N] possible. An unimodal permutation… Read More
Given an array, arr[] of size N consisting of elements from the range [1, N], that represents the order, in which the elements are inserted… Read More
Given two strings, str1 of length N and str2 of length M of distinct characters, the task is to count the number of ways to… Read More
Given an integer N where 1 ≤ N ≤ 105, the task is to find whether (N-1)! % N = N – 1 or not.Examples:… Read More
Given a number N, print all the Strong Numbers less than or equal to N.  Strong number is a special number whose sum of the… Read More
Given two number X and N, the task is to find the last digit of X raised to last digit of N factorial, i.e. .Examples:   Input:… Read More