LeetCode 139. Word Break - Interview Prep Ep 79

Fisher Coder
Fisher Coder
25.9 هزار بار بازدید - 4 سال پیش - ⭐ Shop on Amazon to
⭐ Shop on Amazon to support me: https://www.amazon.com/?tag=fishercod...
⭐ to protect your online privacy: https://n.net/aff_c?offer_id...
⭐ NordPass to help manage all of your passwords: https://go.nordpass.io/aff_c?offer_id...

Problem link on LeetCode:
Word Break: https://leetcode.com/problems/word-br...

⭐ Support my channel and connect with me:
@fishercoder

Algorithm explained:
We use an extra boolean array of size n+1 to serve as a cache, which means up to position dp[i], it's possible that there is a valid word in the given dictionary to break the string into. We use two pointers to loop through all possible substring breakdowns and store the temporary results into this boolean array called DP to help us cut repetitive computations. In the end, we could just return DP[N].

// TOOLS THAT I USE:
○ Memory Foam Set Keyboard Wrist Rest Pad  - https://amzn.to/3cOGOAj
○ Electric Height Adjustable Standing Desk  - https://amzn.to/2S9YexJ
○ Apple Magic Keyboard (Wireless, Rechargable) - https://amzn.to/36gy5FJ
○ Apple Magic Trackpad 2 (Wireless, Rechargable)  - https://amzn.to/36ltimu
○ Apple MacBook Pro  - https://amzn.to/30iSvKE
○ All-In One Printer  - https://amzn.to/34etmSi
○ Apple AirPods Pro  - https://amzn.to/2GpVYQf
○ My new favorite Apple Watch  - https://amzn.to/2EIIUFd

// MY FAVORITE BOOKS:
○ Introduction to Algorithms  - https://amzn.to/36hxHXD
○ Designing Data-Intensive Applications  - https://amzn.to/2S7snOg
○ Head First Java  - https://amzn.to/2ScLDKa
○ Design Patterns  - https://amzn.to/2SaGeU2


Follow me on Github for complete LeetCode solutions: https://github.com/fishercoder1534/Le...

Support me on Patreon: Patreon: fishercoder

My ENTIRE Programming Equipment and Computer Science Bookshelf:
https://www.amazon.com/shop/fishercoder


And make sure you subscribe to my channel!

Your comments/thoughts/questions/advice will be greatly appreciated!

#Kahnsalgorithm #graphsearch #topologicalsorting #softwareengineering #leetcode #algorithms #coding #interview #SDE #SWE #SiliconValley #programming #datastructures
4 سال پیش در تاریخ 1399/05/05 منتشر شده است.
25,914 بـار بازدید شده
... بیشتر