Paypal campus challenge 2020

It’s a recursive + memoization problem. Recurse on all the choices at every step and take the maximum of them. If a room has already been visited do not solve that subproblem again, use memoization. But Java would not work for me using this approach because of the stack space, so I used C++ and it worked.

I was able to get only half of the test cases cleared using the similar approach. Don’t know where I missed. Btw could you please share the code or ss if you have it by any chance

Hey, in the 2nd question, wasn’t it giving you wrong answers because they were multiple solutions and if your solution was different from theirs?

Hi, I can tell you my approach althoughmine didn’t pass

  1. First get those connected components which are trees.
  2. Visit their vertices.
  3. Remaining unvisited vertices are simply part of cycles, which I deduced. Kindly correct if this deduction is wrong.
  4. Convert these cycles to trees by starting from any of their nodes.and assign the parent of the starting vertex as the vertex itself.
  5. now if there are n forests altogether, then simply connect the root of each forest to the first forest that we obtained.

https://pastebin.com/Re8e9CLe

It’s something like this. Mostly correct.

Okay. Thanks :slight_smile:

How much were you able to solve?

Yes I also faced the same. It was only accepting one particular answer not any of the possible tree.

Just two.

The second problem was directly from codeforces.

But wasn’t able to pass all the test cases.
They clearly mentioned that you can print any possible answer but actually they have fixed the answers.

1 Like

how many test cases were passed?

were you able to do 1&3 ques as well?

how did you solve the third one?

In the second question, my code was worked on around 60% of test cases.
And I was able to solve the first question fully.
Haven’t touched the third one.

Isn’t it possible to reach a door with a different prev_jump_length? For example, reach door 100 with jump 10 or reach door 100 with jump 9. If so, isn’t it required to have a matrix for dp instead of an array? Why does a simple array work?

I just got an email from them first round is telephonic on 23rd Nov.
I have my college exams in that week, should I ask them to reschedule.
Please suggest.

1 Like

yes bro ask them.

1 Like

Hey, did you gave your paypal interview?

Hi Please share your experience.

I actually asked them to reschedule it as my college exams are going on. So its on 30th now. Has anybody else gave it?

I gave the exam on 21st November. I solved the first question partial, 2nd and 3rd question full. I still didn’t receive any mail from them.