pandey_04's blog

By pandey_04, history, 3 years ago, In English
Code

Full text and comments »

  • Vote: I like it
  • -14
  • Vote: I do not like it

By pandey_04, 3 years ago, In English

What is the time complexity of this recursive function ?

Pseudocode-

def f(n): if n == 0 {return 1} else {return f ( n // 3 ) + f ( n // 3 )}

Using the recursion tree method, my answer comes out to be O(2^log(n)). Log has base 3. Correct me if I am wrong.

If my answer is correct, what does this time complexity mean ?

What will be the closest and more meaningful upper bound ?

How can it be compared with O(n) ?

btw I am solving pashka's A&DS Course- S01E01 home task. Here's the link to blog — link

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it

By pandey_04, 3 years ago, In English

Problem — link My solution — link

I genuinely feel there is a minor mistake in the code so, I would like to receive some help in spotting that instead of being introduced to some new approach. I love different approaches for one problem but this is different, I want to know why this one does not work. Have a look please.

UPD: A/C Solution: link

Full text and comments »

  • Vote: I like it
  • -1
  • Vote: I do not like it

By pandey_04, 3 years ago, In English

Link to problem: problem Link to editorial: editorial

Problem B — Bad boy

I got the idea given in editorial but can anyone tell me how the distance will always be 2*(n — 1) + 2*(m — 1) when putting the two yoyos in corners which form a diagonal. And, won't the distance be larger if we put the yoyos on the diagonal which is farther from the position of Riley than the one which is closer ?? How the largest distance is always same irrespective of position of Riley. All comments are highly appreciated.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By pandey_04, history, 3 years ago, In English

Link to solution

The problem is a graph problem where you have to output the node which is already visited, that's about it. But, due to some reason, the output is going wrong after some number of pretests. Can your please have a look into it point out where am I going wrong ??

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it

By pandey_04, history, 3 years ago, In English

CF is showing runtime error on test 3 because of out of bounds which I think is not true because the code is working fine in local IDE, It's just that the input won't process without pressing enter in local IDE. Why is that ? maybe that's why the input is not getting accepted and runtime error is showing. Also, I think the out of bounds is not legit because that statement is inside 'if' block, so it just won't get executed if the statement is not true. Please have a look at at and tell me why this code is not executing for test 3. Thank you in advance. click Code Link

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it