Блог пользователя pandey_04

Автор pandey_04, история, 3 года назад, По-английски
Code

Полный текст и комментарии »

  • Проголосовать: нравится
  • -14
  • Проголосовать: не нравится

Автор pandey_04, 3 года назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • -2
  • Проголосовать: не нравится

Автор pandey_04, 3 года назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится

Автор pandey_04, 3 года назад, По-английски

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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор pandey_04, история, 3 года назад, По-английски

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 ??

Полный текст и комментарии »

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

Автор pandey_04, история, 3 года назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится