Fundamental principles and operations used in problem-solving and algorithm design.
Problem Statement: Given a range L to R, calculate the number of prime numbers in it. Note: Q Examples Example 1: Input:N=10 Output:[2, 3, 5, 7] Explanation: All numbers before 10 are 1, 2, 3, 4, �...
Problem Statement: Given an integer N return the reverse of the given number. Note: If a number has trailing zeros, then its reverse will not include them. For e.g , reverse of 10400 will be 401 in...
Problem Statement: Given a positive integer N, print the digits of N separately. Examples Example 1: Input:N = 12345 Output: [‘1’, ‘2’, ‘3’, ‘4’, ‘5’] Explanation: The digits of...
Problem Statement: Given an integer N, return the number of digits in N. Examples Example 1: Input:N = 12345 Output:5 Explanation: The number 12345 has 5 digits. Example 2: Input:N = 7789 Output: 4...
Problem Statement: Given a decimal number N, return true if it is a power of 2. If not, return false. Examples Input: N = 16 Output: True Explanation: 16 (Binary: 1000) is a power of 2 (2^4 = 16)....
Problem Statement: You are given an integer n. Print all the prime numbers till n (including n). A prime number is a number that has only two divisor's 1 and the number itself. Examples Input: N =...
Problem Statement: Given an integer N, return all divisors of N. A divisor of an integer N is a positive integer that divides N without leaving a remainder. In other words, if N is divisible by ano...
Problem Statement: Given a number N reverse the number and print it. Examples Input: N = 123 Output: 321 Explanation: The reverse of 123 is 321 Input: N = 234 Output: 432 Explanation: The reverse o...
Problem Statement: Given a Binary Number convert it to its equivalent decimal number. Binary to Decimal in C. Examples Input : N = 101 Output : 5 Explanation : Binary 101 = (1 × 2²) + (0 × 2¹)...
Problem Statement: Given two numbers, Find the GCD of two given numbers . Examples Input: n1 = 4, n2 = 8 Output: 4 Explanation: The common divisors of 4 and 8 are {1, 2, 4}. The greatest among them...