# Tag Archives: number-theory

In this post, we will discuss Important top 10 algorithms and data structures for competitive coding. Topics :  Graph algorithms Dynamic programming Searching and… Read More
Given a number n, check if it is prime or not. We have introduced and discussed School and Fermat methods for primality testing.Primality Test |… Read More
Given a number n, check if it is prime or not. We have introduced and discussed the School method for primality testing in Set 1.Primality… Read More
Given a positive integer, check if the number is prime or not. A prime is a natural number greater than 1 that has no positive… Read More
Euler’s Totient function Φ(n) for an input n is the count of numbers in {1, 2, 3, …, n} that are relatively prime to n,… Read More
Given a positive integer n, find if it can be expressed as xy where y > 1 and x > 0. x and y both… Read More
Puzzle: You are provided with a chessboard and are asked to find the number of squares in it. A chessboard is a board with 8… Read More
Given two integers ‘a’ and ‘m’, find modular multiplicative inverse of ‘a’ under modulo ‘m’.The modular multiplicative inverse is an integer ‘x’ such that.  a… Read More
Euler’s Totient function Φ (n) for an input n is the count of numbers in {1, 2, 3, …, n} that are relatively prime to… Read More
Given an integer n and a prime number p, find the largest x such that px (p raised to power x) divides n! (factorial) Examples:   Input:… Read More
Factorial of a non-negative integer, is the multiplication of all integers smaller than or equal to n. For example factorial of 6 is 6*5*4*3*2*1 which… Read More
MakeMyTrip recently visited our campus. Below is my interview experience:  Round 1: (Online MCQs) Section A- There were 20 Aptitude and Logical Reasoning questions which has… Read More
MS Excel columns have a pattern like A, B, C, …, Z, AA, AB, AC, …., AZ, BA, BB, … ZZ, AAA, AAB ….. etc.… Read More
Written Round: 1) Given a binary tree, such that each node contains a number. Find the maximum possible sum in going from one leaf node… Read More
Given a string, find its rank among all its permutations sorted lexicographically. For example, rank of “abc” is 1, rank of “acb” is 2, and… Read More