## Math & Computation Interview Questions

- 0of 0 votes

AnswersA number series have numbers in the increasing order where numbers are of the form 2^m*3^n*5^p. where m,n,p are an non negative integers. The initial few number of the series are

- nikhils.codecracker March 25, 2014 in India for Retail

1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18......

Write a function to get the nth term of such a sequence.| Report Duplicate | Flag | PURGE

Flipkart SDE-2 Math & Computation - 1of 1 vote

AnswersIn a book with N pages, pages are numbered from 1 to N. Find out how many times

- samar.pratap.singh.bundela February 06, 2014 in India for payments

each digit occurs in that book.

You are expected to complete the function getDigitslnBook, which takes an integer as input and

prints how many times each digits occur, one in a line.

The Nth line in the output denotes how many times the integer N-1 occurs in page numbers.

Constrains:

N will be between 1 and 1,000,000,000, inclusive.

The output will fit in an integer.

Sample lnputOO:

7

Sample Outputo : 0

1

0

0

Explanation :

The page numbers are 1,2, 3,4, 5, 6 and 7.

Sample lnput01: 11

Sample Output01:

1

4

Explanation:

Digit 1occurs 4 times, at 1,10 and 11.Rest of the digits occurs only once.| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Math & Computation - -11of 13 votes

AnswersIf you had a savings account with $1, at a 100% interest rate, at what year would you have 15 billion dollars? I know it's Log base 2 of 15 billion. But how did it get to log base 2? What's the formula here?

- Guy January 29, 2014 in United States| Report Duplicate | Flag | PURGE

Google Software Engineer / Developer Math & Computation - 0of 0 votes

AnswersGiven a number N, now find the smallest number K such that product of digits of K is equal to N. If there is no such K then return -1.

- user124 January 27, 2014 in India

Suppose N = 100, then K = 455

N=26, K = -1| Report Duplicate | Flag | PURGE

Amazon Software Development Manager Algorithm Math & Computation - 0of 2 votes

AnswersHow many steps are there if we start counting from 0 to 10.??? it would be 10 or 11... elaborate plz.

- rooshan87 December 16, 2013| Report Duplicate | Flag | PURGE

Math & Computation - 0of 0 votes

AnswersDart thrown land up uniformly and random at a distance from centre of a unit circle. Distance from center is in the range [0,1]. One who lands up farther from the center loses and the loser pays amount equal to distance from the centre. What is the expected pay?

- pratiksahoo33 December 09, 2013 in India| Report Duplicate | Flag | PURGE

Credit Suisse Analyst Math & Computation - 1of 1 vote

AnswersHow to represent a number in base -2? (negative -2 base) eg 6 can be 11010 i.e. 16 -8 +0 -2 +0 = 6.

- Roxanne November 23, 2013 in United States| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Math & Computation - 2of 2 votes

AnswersWAP to sort prime numbers smaller than given N by digits. If N is 40, the output should be 11, 13, 17, 19, 2, 23, 29, 3, 31, 37, 39, 5, 7.

- lngbrc October 24, 2013 in United States

Follow-up question: limit memory usage.| Report Duplicate | Flag | PURGE

Amazon Senior Software Development Engineer Math & Computation - -2of 2 votes

AnswersAsked question on expansion of {2x-3y}^3 ?

- java.interviews.questions October 16, 2013 in India

and equation of line?| Report Duplicate | Flag | PURGE

Citigroup Java Developer Math & Computation - 1of 1 vote

AnswerFormula for nth PI is (-1^n)/(2n+1). Write an efficient way to calculate this.

- JSDUDE June 27, 2013 in United States

After i wrote a recursive and iterative solution, she wanted a faster solution. So i went to threading.

Eventually she said that if the value of n is a million and you can't have million threads how will you distribute:

Problem is as n increases the above computation becomes time consuming and hence cannot be simply split in ranges.

She hinted me towards: Queue of jobs, threads picking jobs and en-queuing the work| Report Duplicate | Flag | PURGE

Ebay SDE1 Math & Computation Threads - 0of 0 votes

AnswersWrite a function to calculate the nth prime number:

- JSDUDE June 27, 2013 in United States

N = 0; Prime#: 2

N=1; Prim#: 3

What is the complexity of this alogirthm| Report Duplicate | Flag | PURGE

Ebay SDE1 Math & Computation - 0of 0 votes

AnswersImplement (in C++, MATLAB, or Java) a Fraction class that supports the following operations: addition, subtraction, multiplication, division, equality/non-equality, greater than/less than, and display. The program should take on the order of several hours. If there are techniques that would take longer to implement, note it down as comments.

- AnOnYmOuS June 24, 2013 in India| Report Duplicate | Flag | PURGE

Algorithm C++ Coding Java Math & Computation - 1of 1 vote

AnswersHow many unique words(does not required to have meaning) can you generate from a "EFFICIENT" word

- raghav.nagabandi June 21, 2013 in India| Report Duplicate | Flag | PURGE

Google Quality Assurance Engineer Math & Computation - 0of 0 votes

AnswersWe toss a fair coin n times. A k-streak of flips is said to occur starting at toss i, if the outcome of all the k flips starting from i th flip is the same. For example, for the sequence HTTTHH, there is a 2-streak occurring at 2 nd toss, there is a 2-streak occurring at 3rd toss, and there is a 2-streak occurring at 5th toss. Here the total number of 2-streaks is 3 in the sequence HTTTHH. What is the expected number of k-streaks which you will see in n tosses of a fair coin ?

- oglA June 21, 2013 in United States| Report Duplicate | Flag | PURGE

Algorithm Math & Computation Probability - -5of 7 votes

Answersneed to implement a weather report functionality. user will provide the city name , need to return the weather report.

- gopi.komanduri May 29, 2013 in India

if weather station exists n functioning properly , will return the weather report of that station .

else ,

will return the nearest available weather station report.

interviewer looking for optimized manner.

looking for datastructures to stores the cities n algo to return the report.| Report Duplicate | Flag | PURGE

Mentor Graphics Analyst Algorithm Arrays Bit Manipulation Brain Teasers C C# C++ Cache Coding Computer Architecture & Low Level Data Mining Data Structures Dynamic Programming General Questions and Comments Graphics Hash Table Ideas Linked Lists Math & Computation Object Oriented Design Problem Solving Sets Sorting Stacks String Manipulation Terminology & Trivia Threads Trees and Graphs XML - -2of 2 votes

Answersfunction takes input x , y , A and N

- ZZZZZZZ April 22, 2013 in United States

returns true if

there are atleast N pairs of x and y satisfying

x^3 + y^3 = A;

all inputs are postive integer values| Report Duplicate | Flag | PURGE

Algorithm Math & Computation - 1of 1 vote

AnswersGiven a function

- Vikas March 05, 2013 in United States

float convex(float x)

WAP to find the minimum value of convex() between x1 and x2. convex is first monotonically decreasing and then monotonically increasing between x1 and x2.

float minima(float x1, float x2)| Report Duplicate | Flag | PURGE

Pocketgems Software Engineer / Developer Math & Computation - 0of 0 votes

AnswersThe programming problem is:

- teja.sbt November 05, 2012 in United States for Speech Recognition

Each turn of a simulation, car A has a 10% chance of moving 5 feet forward, and a 90% chance of staying still. Similarly, each turn of the simulation car B has a 60% chance of moving 1 feet forward, and a 40% chance of staying still. A race consists of however many turns in the simulation it takes to travel 100ft. Write a simulation to run such a race, and run it 100 times. Count how many times car A wins and how many times car B wins. Do the results match up with what you would expect from a mathematical analysis of the problem?| Report Duplicate | Flag | PURGE

Raytheon Software Engineer / Developer Math & Computation - 0of 0 votes

AnswersRandom number generator

- rs October 28, 2012 in United States

There is an ideal random number generator, which given a positive integer M can generate any real number between 0 to M with equal probability.

Suppose we generate 2 numbers x and y via the generator by giving it 2 positive intergers A and B, what's the probability that x + y is less than C? where C is a positive integer.

Input Format

The first line of the input is an integer N, the number of test cases.

N lines follow. Each line contains 3 positive integers A, B and C.

All the integers are no larger than 10000.

Output Format

For each output, output a fraction that indicates the probability. The greatest common divisor of each pair of numerator and denominator should be 1.

Input

3

1 1 1

1 1 2

1 1 3

Output

1/2

1/1

1/1| Report Duplicate | Flag | PURGE

Software Engineer / Developer Algorithm Math & Computation - 0of 0 votes

AnswersTo generate armstrong numbers ...In O(n)..

- laterGator September 11, 2012 in United States| Report Duplicate | Flag | PURGE

Microsoft Student student Math & Computation - 0of 0 votes

AnswersWhat is the difference between random and pseudo-random numbers? Write two function that can generate numbers of the two types and prove randomness.

- edoc0code August 08, 2012 in United States| Report Duplicate | Flag | PURGE

Shutterfly Software Engineer / Developer Math & Computation - 0of 0 votes

AnswersGiven an array of positive integers, and a number K. Find pairs(a,b) from the array such that a%b=K. % is the mod(remainder) operation. The interviewer wanted better than O(n^2) time complexity.

- nikunj165 July 19, 2012 in India for Payu| Report Duplicate | Flag | PURGE

Ibibo Software Engineer / Developer Math & Computation - 0of 0 votes

AnswersWrite code to compute number of structural different binary trees for given 'n' number of nodes. (with and without Catalan number)

- Ram June 10, 2012 in United States| Report Duplicate | Flag | PURGE

Algorithm Data Structures Math & Computation - 0of 0 votes

AnswersIn 1000 wine bottles stack 10 are poisoned given 10 rats what is the minimum number of tries to find the poisoned one. Rat dies once it licks the poisoned wine.

- Pranay Singhania May 27, 2012 in India| Report Duplicate | Flag | PURGE

Yahoo Software Engineer / Developer Math & Computation - 0of 0 votes

AnswersQ2. Written Exam Amazon(Bangalore)

- Nitin Gupta May 12, 2012 in India

Given a number in the form of string. Output the binary equivalent of that number.

Sample Input: "8.5"

Sample Output: 1000.1

Sample Input: "12.34.23"

Sample Output: "ERROR"| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Algorithm C C# C++ Coding Java Math & Computation - 0of 0 votes

Answersimplement sqrt(x)

- Lively May 06, 2012 in United States| Report Duplicate | Flag | PURGE

NVIDIA Software Engineer / Developer Math & Computation - 0of 0 votes

AnswersWhat is true about the value of π – (22/7) where π is the ratio of the circumference of a circle to its diameter in a Euclidean plane? (a) It is 0. (b) The value changes gradually every year as the universe expands. (c) It is close to 0.001. (d) It is close to -0.001

- gigo April 05, 2012 in India| Report Duplicate | Flag | PURGE

RSA Intern Math & Computation - 0of 0 votes

AnswersReturn all factorials of given integer. Enhance your approach by avoiding linear traversing.

- test222 March 29, 2012 in United States| Report Duplicate | Flag | PURGE

Amazon Intern Math & Computation - 0of 0 votes

AnswersDesign an algorithm such that we have to find the k th element in the array such that their only prime factors are 3,5 an 7.

- keerthy August 03, 2011

Example: Array will contain 1,3,5,7,9,21,25,...

We have to return the kth element in array...!!!| Report Duplicate | Flag | PURGE

Chronus Software Engineer / Developer Math & Computation

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window