Goldman Sachs Interview Question for Software Engineer / Developers






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

How about one of the following approaches:

1) find exp (0.8 * log x)
2) Using Newton-Raphson/Bisection method to solve the equation: y^2 - x = 0.

- Vijay October 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I meant: exp(0.5 * log x).

- Vijay October 28, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

seems like transformation..

- lwz November 12, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

If it is a perfect squre then, similar post is there on site.
else above method is good.

- Piyush November 26, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

using binary search

- tzbluebaby March 13, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

best way :

double a = (double) num;
double x = 1;

// For loop to get the square root value of the entered number.
for( int i = 0; i < n; i++)
{
x = 0.5 * ( x+a / x );
}

System.out.println("sqrt of " + a + " is " + x);

- xyz March 09, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Using binary search actually is the worst way to do that. Because when the square just get to 10 the x = 100 and the time used to find 100's square is log2(100) almost equal to 7(becz 2^7 = 128) just a little bit overruns the linear search. 

My way is to check linearly but a little bit different:

int Find_SR(int x)
{
	vector<int> T;
	int rest = x; /*to store the rest factor*/
	for(int i=2;i<n;)
	{
		if(rest%(i*i)==0)
		{
			rest = rest/(i*i);
			T.push_back(i);
			i=2;
		}
		else
		{
			i++;
		}
	}
	// using for loop to print out the factor that stored in vector.
	
}

- Jun March 04, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

use binary search recursively, by first we are able to know integer value, next apply binary search on 1 to 10 to know first decimal, then apply again and again to make it more accurate, complexity : O(log(n))

- sonesh November 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

if not utilize Math package, the best ans I personally take is using newton's method

- cst August 20, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Math.pow(3, 0.5)

- rajesh April 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Math.pow(n, 0.5)

- rajesh April 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Math.pow(n, 0.5)

- rajesh April 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Math.pow(n, 0.5)

- rajesh April 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Math.pow(n, 0.5)

- rajesh April 23, 2012 | 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