How was your Goldman Sachs exam?

I know the platform but really hate the interface . also unaware how to solve in practice llike cf and others…

any idea what the test case 3 was for the first question? also i was getting timeout in the second question, i was caculating the prime factors and then applying the stars and bars second formula.

For first problem you should consider the case when (n<=1).
And for 2nd problem you may be use sieve algorithm for fast calculation of prime factor.

what should be the output when n<=1? there was nothing mentioned in the post? was -1 to be returned?

Learn to learn and modify.

1 Like

That case n<=1 was incorrect in test data itself imo.

1 Like

Google beggars formula.

1 Like

Nope 3 test cases shows “aborted”.
Still no idea why. :disappointed:
It was not wrong answer definitely.

1 Like

Same here. One possibility is test cases were incorrect or Main function had issues.
Because n<=1 case was also incorrect in 1st problem.

1 Like

I got AC.
if(n<=1)
return input_list;

IMO n=0 should return given vector itself.
And n=1 should return vector having one element = 1

4 Likes

Same here. Cuz test cases were incorrect.

3 Likes

In 1st problem right ?

2 Likes

Yup… :smile: some random 20 character

1 Like

yes for the first one…

what was the return type of the function int or vector ???

for problem 2nd can we use this formula
primesum * k! - primsun+1

That sucks, I spend about 15 mins in Hotel question to reduce 4 matrix into 2 (saw Abort error means excess memory used) but still Abort Error and also another 10 mins for question 1’s n<=1 test case ( found it by having an infinite while loop which led to TLE) and ultimately due to lack of time I couldn’t attempt question 2.

this formula is working
primesum * k! - primsum+1
am i wrong?

Ohh that means memory issue. ****
I didn’t know.
I could have declared them globally. I could have managed to solve with less memory.

1 Like