silenttkillerr's blog

By silenttkillerr, history, 19 months ago,

This Question logic implemenation is easy , but as test case is very large so it is not able to pass in 2 seconds even after Meomizing the answer.

Images :

https://imgur.com/gallery/anvdek1

• -25

 » 19 months ago, # |   0 Auto comment: topic has been updated by silenttkillerr (previous revision, new revision, compare).
 » 19 months ago, # |   0 This problem can not be solved.
•  » » 19 months ago, # ^ |   0 why? . This asked in Paypal interview
•  » » » 19 months ago, # ^ |   0 You have to write the problem for people to solve it.
 » 19 months ago, # |   0 Auto comment: topic has been updated by silenttkillerr (previous revision, new revision, compare).
 » 19 months ago, # |   0 Auto comment: topic has been updated by silenttkillerr (previous revision, new revision, compare).
 » 19 months ago, # |   0 There are up to 2 parts of each sequence of events 1) ball is passed around without entering a cycle 2) eventually the ball will enter into a cycle for large number of passes. Proof: if there are more passes that people, then some person must receive the ball more than once by pigeon hole principle.You need to handle both cases elegantly. The cycle part needs to be handled with modular arithmetics.
•  » » 19 months ago, # ^ | ← Rev. 3 →   +3 so we just figure out the cycle size and check if the number of passes in the questions is below that or above that and give the ans using modular arithmetics right?
•  » » » 19 months ago, # ^ | ← Rev. 2 →   0 Yep, you got it! Also note that the cycle may not start on the first person so you need to handle that too.
•  » » » » 19 months ago, # ^ |   +3 i don't get how these questions seemed so damn hard when i was giving company online assessments, but now they seems like a breeze lol