Re: interview question on primes
- From: Usher73 <Usher73@xxxxxxxxx>
- Date: Wed, 27 Feb 2008 01:11:57 EST
Got this on a software engineering interview
question:
given two integers A and B, find all primes between
them.
I basically wrote an initial function, bool
isPrime(int i), which
loops over all numbers between 2 and sqrt(i) to see
if i%num == 0,
in which case the number is not a prime. With this
function, I then
loop between A and B, calling isPrime() on each
value.
Any better ideas?
I'm curious about 2 things:
1. What was the interviewer's response to your solution ?
2. What type of software job were you interviewing for ?
I spent many years as a so-called software engineer in the financial world, and never once had to find a prime number.
.
- References:
- interview question on primes
- From: Digital Puer
- interview question on primes
- Prev by Date: Re: constant and locally constant
- Next by Date: Re: Standard Topology on S^n ?
- Previous by thread: Re: interview question on primes
- Next by thread: Fundamentals of Electromagnetics with MATLAB solution manual
- Index(es):
Relevant Pages
|