Does EPI have problems on Sliding Window?

#1

Does EPI have problems on Sliding Window? I have completed have of the chapters but did find problems related to “Sliding Window”.

0 Likes

#2

I don’t remember if the book particularly called it out as “sliding window” but I can think of these two of the top of my head:

  • Find the smallest subarray covering all values
  • Find the smallest subarray sequentially covering all values

Both of them are part of the Hash Tables chapter as they use LinkedHashMap/HashMap to maintain the sliding window.

1 Like

#3

Thanks for the response. I haven’t done chapters from the hash tables.
I will check out both the problems.

Thanks again, appreciate you help.

0 Likes

#4

Sure, you’re welcome! I’ve only been till the Recursion chapter. The book is tough to go through and you’ll need to both watching or read explanations of the solutions to the problems elsewhere like on LeetCode or YouTube but it’s totally worth it and rewarding.

I wish this forum had more activity. It seems to have slowed down a lot.

0 Likes

#5

Yes, this book is quite hard.
I wish there was discord group for EPI. It would be much faster to share ideas and thoughts there:)

0 Likes

#6

Hey, I’m currently solving problems from Recursion chapter, mostly they are backtracking problems and I can tell that this is the first chapter I haven’t managed to solve even one question fully correctly yet :broken_heart:

@simpleprogrammer How is recursion chapter going for you? I’ve tried to strengthen my knowledge on backtracking, I’ve glanced at the ‘Combinatorial Search’ chapter on Algorithm Design Manual. However I’m trying to find a balance between finishing chapters and studying topics so I’ve decided to continue to solve problems and leave reviewing this topic to later.

Do you have any recommendation on understanding the fundamentals of the problems on recursion chapter more thoroughly?

0 Likes

#7

@yoay
even I used to face a lot of difficulty in recursion, backtracking and DP. I would not be able to solve the easy problems also.
My friend suggested me to do problems from “Cracking the Coding Interview”. It really helped me a lot. I was able to solve the problems in the Recursion chapter of EPI after that. I would highly suggest you to do that.

1 Like

#8

Hi @slow_tortoise, I’ll definitely check CTCI’s chapter. As I remember CTCI was occasionally implementing brute force approaches as well, so it might help me to understand better.

This was a great suggestion thanks!

0 Likes

#9

@yoay - I’m on the same boat. It’s been tough. I think I was able to solve only 1 problem on my own. The variations, even though they are just subtle, have been tough. I tried drawing the recursion trees to help understanding those slight variations in each problem. It helped me a bit. But surely, this needs a lot of practice and I’m simply going to use a brute force learning approach to internalize these concepts as I didn’t find any other way. By brute force, I mean:

  • Attempt and fail (done)
  • Code it using the book solution or other sources (done)
  • Try drawing the recursion trees to truly understand what went on (done)
  • Give some time (spaced repetition technique)
  • Repeat from step 1 till I succeed

You’re right that these are mostly backtracking problems. I’m guessing the other recursion related problems are going to be in the Dynamic Programming chapter but I haven’t done even a single problem in that yet. I’m finishing the chapters in the book in sequence.

To understand concepts, I mostly search on YouTube and watch several videos till I find one that explains the intuition in a better way. For the very fundamentals of recursion and recurrence relations, you can watch this playlist, although I believe you must be past this stage: https://www.youtube.com/playlist?list=PL2_aWCzGMAwLz3g66WrxFGSXvSsvyfzCO

An example of the recursion tree can be found in the image on this link: https://www.geeksforgeeks.org/print-all-possible-combinations-of-r-elements-in-a-given-array-of-size-n/ (I tried drawing similar trees for most of the other problems). So basically I did Google Image Search for finding existing traces by other people and tried doing them myself.

I feel finishing EPI and completely sinking the content in to our subconscious will take 2-3 years of solid learning and effort from us.

1 Like

#10

For sure it will help you.
For each problem, it has a series of hints. This will keep pushing in the right direction. At each hint spend some time trying to solve the problem. After few problems, I was able to apply that breaking down steps to every recursion or DP problem.
You just need to do the problems in “Recursion and DP” section. They just have same section for both.

1 Like

#11

@simpleprogrammer You’re so right about drawing recursion trees. It came to my mind only after solving a few questions and definitely helped me as well.

Thank you for sharing your strategy of solving problems I’ll check the youtube videos and CTCI chapter which @slow_tortoise mentioned while I review recursion again.

Thanks!

0 Likes

#12

@tsunghsienlee and others in that chat. I am following EPI-Python programs and couldn’t really wrap my head around the solution/explanation for the problem - Find smallest subarray sequentially covering all values. Request you to kindly assist.

0 Likes