Adobe Noida | CS1

Anonymous User
524
Sep 09, 2022

round 1, 7th sept

Very bad experience.
Contrary to what people say that they also ask leetcode medium easy, its not true.
They asked me this:
https://leetcode.com/problems/jump-game-ii/

First after thinking for sometime I gave him, backtracking approach. He said give me better.
Then I told about DP solution, he said he me more better but agreed that this will work.
Then after thinking a lot, I couldnt come up with more better solution then asked him to give him a produciton level code for it using dp.

int getMinSteps(vector<int> &step) {
	int len = step.size();
	if(len ==0) return -1;
	if(len<2) return 0;
	vector<int> dp(len, INT_MAX);
	if(step[0] !=0) dp[0] = 0;
	for(int i=0; i<len; i++) {
		for(int j=i+1; j<len && j<= (i+step[i]); j++) {
			if(step[j] !=0) dp[j] = min(dp[j], dp[i]+1);
		}
	}
	return dp[len-1]==INT_MAX ? -1 : dp[len-1];
 }
  • In solution to him I intialized with INT_MAX, which will overflow. it should have been INT_MAX-1
  • otherwise it worked
  • he wasnt agreeing for it later on agreed.
  • one hr got over in this, so no further questions
  • got feedback a day after next that I wasnt shortlisted.
Comments (3)