Interview Question for Financial Software Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

inverse transformation: 2*sqrt(rand())

- Anonymous June 12, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Why sqrt?

- Anonymous June 13, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

better way is lets have array and repeat number equivalent to the probability you want say for this case array will consists of 0,1,1,2,2,2,2 now we can use this rand function in this way

#define ArrayMax 6 // our index starts from 0
for (int i=0;i<ArrayMax;i++)
{
print ("\t Arr[i*rand()]");
}


this is some sort of the way we can do it

comments are welcome

- CUNOMAD June 15, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

CUNOMAD's solution looks cool to me!

The solution " 2*sqrt(rand()) " needs some explanation.

- Nik June 16, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I am the original poster. I forgot to mention that the numbers are not necessarily integers. In other words, the numbers generated by rand() can be any real number between 0 and 1. It is not the same as the C++ rand() function.

- Anonymous June 19, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

ONLY change in my previous code will be have float array instead of integer

- CUNOMAD June 20, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

The problem description should be letting probability proportional to 0.5x.

- qz August 31, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I would consider just multiplying the random number by 2.

- Karthik December 15, 2010 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More