Gagandeep98's blog

By Gagandeep98, history, 7 weeks ago, In English,

I won't be able to do this regularly as I am doing an internship as well. But I will be available on almost all weekends and most weekdays. Idea is to do a virtual contest in a team and of course, upsolve at least 1 problem.

Even giving virtual contests daily can become boring, so if we don't give a virtual contest on that day, we can try and choose the same topic and everyone will try to share problems that they found interesting and challenge others to solve that problem.

If you are interested, you can let me know. I will prefer it if you are able to solve at least 2 problems in div.2 contests.

Update: Let's give virtual team contests. Will keep the time as 11PM IST on non-contest days

Update 2: Moving to Discord Group Instead Of Whatsapp Invite Link: https://discord.gg/sUa7ccd

Read more »

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

By Gagandeep98, history, 2 months ago, In English,

Can anyone please provide any hint for this problem? Throwing Dice

Read more »

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

By Gagandeep98, history, 2 months ago, In English,

I am stuck on Counting Path 1136 problem, and unable to think how to write an approach optimal to given constraints. Any hint or help is highly appreciated.

I cannot find any place where there is any hint for CSES problems(Except DP and Range Queries), hence thought this as the only possible option.

Read more »

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

By Gagandeep98, history, 2 months ago, In English,

It is becoming very common that I am failing some of the test cases of CSES problems. I am getting WA on 3 out of 17 test cases. I am unable to figure out what is wrong in my approach.

Logic:

Step 1: Apply BFS for all monsters. Store in dist array, dist[i][j], shortest time among all monsters to reach, coordinate (i, j).

Step 2: Apply BFS for A. Store in d array, shortest time from A to coordinate (i, j). It is only possible to reach that coordinate if d[i][j] < dist[i][j]. Check if we have reached the border.

Step 3: Backtrack to generate the path.

PROBLEM LINK CODE LINK

Read more »

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

By Gagandeep98, history, 2 months ago, In English,

My logic is giving WA on 50% of the test cases. I am not able to figure out what is wrong with my logic. Any help would be great.

Logic: I apply a regular dfs, and return true or false. True indicates, that it is indeed the shortest the path, while false indicates, that it is not. If we get a true, then we update the parent node, else we don't.

Code: Code

UPDATE: Solved using DP but would be curious to know, if anyone can do it without DP.

Read more »

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

By Gagandeep98, history, 3 months ago, In English,

I tried to make a video on applying binary search. This is for beginners.

When To Apply Binary Search(For Beginners)

If it helps, you can let me know here or in the youtube comments. If you have any suggestions on what topics, I should cover, then do let me know that as well. If you feel that video is not upto the mark, then, feel free to share your feedback.

I will be happy to make a video on any specific topics, that newbies need help in.

Update: If you are downvoting, then please let me know your suggestions on what I should improve on.

Read more »

 
 
 
 
  • Vote: I like it
  • +8
  • Vote: I do not like it

By Gagandeep98, history, 3 months ago, In English,

The editorialist's solution is not always the easiest one to understand, and I have to go through the entire blog to find who has shared his approach for that particular question.

LeetCode, although not a Competitive Programming website, has a better way of doing that. For each question, you have a discuss section, where you can post your own editorial. That makes it really easy to see all the different approaches used for a problem. Plus, I can sort by most upvotes, so it is very likely that I will find the best explanation at the top.

I think, having that kind of feature on codeforces will be really beneficial.

MikeMirzayanov

Read more »

 
 
 
 
  • Vote: I like it
  • +63
  • Vote: I do not like it