Goldman Sachs Interview Question for Developer Program Engineers


Country: India
Interview Type: Written Test




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

public class CoinChange{

public static void main(String args[]){
int numToChk = 167;
boolean test = chekcNum(numToChk );
}

public static boolean checkNum(int n){

	int temp = n;

	if(n < 3){
		return false;
	}
	if(n %5 == 0){
		return true;
	}
	if(n %3 == 0){
		return true;
	}
	while(temp >= 3){
		temp = temp -3;
		
		if(temp%5 == 0){
			return true;
		}
	}
	return false;
}
}

- Pro April 28, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

16 not possible? dude.. 5*2+3*2 =16

- Kumar January 10, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	
	public static boolean denomination(int numb)
	{
		int a=5,b=3;
		boolean canMakeAmount = false;
		
		while(numb >0)
		{
			numb = numb-a;
			numb = numb%b;
			
			if(numb == 0)
			  canMakeAmount = true;
			  
			if(numb < a && numb < b)
			 break;
		}
		
	    return canMakeAmount;
	}
	
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		System.out.println(denomination(23));
		System.out.println(denomination(16));
		System.out.println(denomination(10));
	}
}

- Himanshu Jain January 10, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	
	public static boolean denomination(int numb)
	{
		int a=5,b=3;
		boolean canMakeAmount = false;
		
		while(numb >0)
		{
			numb = numb-a;
			numb = numb/b;
			
			if(numb == 0)
			  canMakeAmount = true;
			  
		
			if(numb < a && numb < b)
			 break;
		}
		
	    return canMakeAmount;
	}
	
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		System.out.println(denomination(23));
		System.out.println(denomination(16));
		System.out.println(denomination(10));
	}
}

- Himanshu Jain January 10, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

The above code doesn't work. 15 is an example that doesn't work.

- Ali January 10, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class Test {

	private static boolean findDenomination(int num)
	{
		
		int tempNum = num;		
		while(tempNum > 0)
		{			
			tempNum = tempNum - 3;
			if(tempNum >=5 && tempNum%5 == 0)
			{
				return true;
			}
		}
		
		return false;
	}

	public static void main(String[] args) {
		
		System.out.println(findDenomination(110));

	}

}

- sharma.satya05 January 19, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

this will get fail when we give 3 or 5

- swaroop February 28, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static boolean pol(int m){
		if(m<0)
		return false;
		if(m==0)
		return true;
		return pol(m-5)||pol(m-3);
		
	}
	public static void main (String[] args) throws java.lang.Exception
	{
		int m=107;
		boolean b=pol(m);
		if(b)
		System.out.println("yes");
		else
		System.out.println("No");
	}
	
}

- Anwesh February 07, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class sample {
public static void main(String[] args)throws Exception
{
int m=28;
System.out.println(count(m));

}

static boolean count(int m)
{
if(m<=0)
{
return false;
}
else
{
int modFive = m%5;
if(m%3==0 || modFive==0){
return true;
}
else if(modFive >= 3)
{
if((modFive)%3 == 0)
return true;
}
}
return false;
}
}

- swaroop February 28, 2015 | 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