Goldman Sach 2020 New Analyst Post Lodon office Coding 1st round

The test was of 3 hours(though the test did'nt even required that time) which consists of 2 datas tructure and algo questions and 10 math question MCQS mostly probability.
Hope it might be helpful..

Fun Fact: I gave one of the tests of G.S last year for Internship opportunity in INDIA , that test was for about 45 minutes and the coding questions and the math MCQS ,and that test really too hard.

MCQS

image

image

And the 2 coding question.

Question 1:

image

This was a pretty simple question if you think about it.

Code:

string  maxSubstring(string s){
    string maxi="";
    for(int i=0;i<s.size();i++)
        maxi=ma(maxi,s.substr(i));
    return maxi;   
}

Question 2:

image

If you read question properly you will figure out its just a variation of min coin change problem.
Here's the link: https://leetcode.com/problems/coin-change/
It just took me a minute to strike it's just the same question.

My Code:

  int getUmbrella(int requirements,vector<int> sizes) {
        int n=sizes.size();
		sort(sizes.begin(),sizes().end());
        long long t[n+1][requirements+1];
         for(int i=0;i<=requirements;i++)
            t[0][i]=INT_MAX-1;
        for(int i=0;i<=n;i++)
            t[i][0]=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=requirements;j++)
            {
                if(sizes[i-1]<=j)
                    t[i][j]=min(t[i-1][j],t[i][j-sizes[i-1]]+1);
                else
                    t[i][j]=t[i-1][j];
            }
        }
        return t[n][requirements] > requirements?-1:t[n][requirements];
    }
	```
	

	
	**Hope that was helpful .
	If yes Please do an Upvote**
	
Comments (16)