Category Archives: Mathematical

Given an integer, write a function that returns true if the given number is palindrome, else false. For example, 12321 is palindrome, but 1451 is… Read More
Counting sort is a sorting technique based on keys between a specific range. It works by counting the number of objects having distinct key values… Read More
Let us consider the following problem to understand Segment Trees. We have an array arr[0 . . . n-1]. We should be able to 1… Read More
Given a number n, write an efficient function to print all prime factors of n. For example, if the input number is 12, then output… Read More
Given a number n, write an efficient function to print all prime factors of n. For example, if the input number is 12, then output… Read More
Given a number n, write an efficient function to print all prime factors of n. For example, if the input number is 12, then output… Read More
There are two vessels of capacities 'a' and 'b' respectively. We have infinite water supply. Give an efficient algorithm to make exactly 1 litre of water in one of the vessels.
Team : Transportation Location :Hyderabad Round 1 (Online Test) Q1. Find the kth largest value in a BST Q2. Swap the alternate nodes in a singly linked… Read More
The value of Exponential Function e^x can be expressed using following Taylor Series. e^x = 1 + x/1! + x^2/2! + x^3/3! + ...... How… Read More
Write code to convert a given number into words. For example, if “1234” is given as input, output should be “one thousand two hundred thirty… Read More
There are some glasses with equal capacity as 1 litre. The glasses are kept as follows:   1 2 3 4 5 6 7 8 9… Read More
An array of size n is given. The array contains digits from 0 to 9. Generate the largest number using the digits in the array… Read More
Given a stream of numbers, generate a random number from the stream. You are allowed to use only O(1) space and the input is in… Read More
Pascal’s triangle is a triangular array of the binomial coefficients. Write a function that takes an integer value n as input and prints first n… Read More
We know the Pascal’s Identity very well, i.e. ncr = n-1cr + n-1cr-1 A curious reader might have observed that Pascal’s Identity is instrumental in… Read More