Code Harmony
Code Harmony
  • Видео 195
  • Просмотров 50 407
LeetCode 2185 Counting Words With a Given Prefix | Easy | String Matching | Asked in Google
LeetCode Problem 2185. Counting Words With a Given Prefix [ 9 Jan 2025 ]
🔗 Resources & Links:
WhatsApp Channel: whatsapp.com/channel/0029Va8WpdlI1rchTrZU2O0l
Telegram Group: t.me/+4z-BZ2HuwHBmZDdl
Discord Server: discord.gg/p3vtnzFbn5
Link to My Solution: leetcode.com/problems/counting-words-with-a-given-prefix/solutions/6252270/beginner-friendly-easy-beats-100-detaile-m4gh
Connect with Me on LinkedIn: www.linkedin.com/in/sahil1012/
📌 Video Overview:
Dive deep into the solution for the LeetCode challenge titled '2185. Counting Words With a Given Prefix'. Whether you're kickstarting your coding journey or aiming for roles at tech giants like Facebook, Amazon, Apple, Netflix, or Google, this tuto...
Просмотров: 63

Видео

LeetCode 1408 String Matching in an Array | Easy | String Matching | Asked in Google
Просмотров 352 часа назад
LeetCode Problem 1408 String Matching in an Array [ 8 Jan 2025 ] 🔗 Resources & Links: WhatsApp Channel: whatsapp.com/channel/0029Va8WpdlI1rchTrZU2O0l Telegram Group: t.me/ 4z-BZ2HuwHBmZDdl Discord Server: discord.gg/p3vtnzFbn5 Link to My Solution: leetcode.com/problems/string-matching-in-an-array/solutions/6249226/easy-to-understand-beginner-friendly-nai-mgwy Connect with Me on LinkedIn: www.li...
LeetCode 3042 Count Prefix and Suffix Pairs I | Easy | String Matching | Asked in Uber
Просмотров 462 часа назад
LeetCode Problem 3042 Count Prefix and Suffix Pairs I [ 8 Jan 2025 ] 🔗 Resources & Links: WhatsApp Channel: whatsapp.com/channel/0029Va8WpdlI1rchTrZU2O0l Telegram Group: t.me/ 4z-BZ2HuwHBmZDdl Discord Server: discord.gg/p3vtnzFbn5 Link to My Solution: leetcode.com/problems/count-prefix-and-suffix-pairs-i/solutions/6249247/easy-to-understand-beginner-friendly-pro-nveu Connect with Me on LinkedIn...
LeetCode 2270 Number of Ways to Split Array | Prefix Sum | Asked in Amazon
Просмотров 7414 часов назад
LeetCode Problem 2270. Number of Ways to Split Array [ 3 Jan 2025 ] 🔗 Resources & Links: WhatsApp Channel: whatsapp.com/channel/0029Va8WpdlI1rchTrZU2O0l Telegram Group: t.me/ 4z-BZ2HuwHBmZDdl Discord Server: discord.gg/p3vtnzFbn5 Link to My Solution: leetcode.com/problems/number-of-ways-to-split-array/solutions/6221674/beginner-friendly-easy-to-understand-100-nkim Connect with Me on LinkedIn: w...
LeetCode 2559 Count Vowel Strings in Ranges | Prefix | Array | Asked in PayPal
Просмотров 17116 часов назад
LeetCode Problem 2559 Count Vowel Strings in Ranges [ 2 Jan 2025 ] 🔗 Resources & Links: WhatsApp Channel: whatsapp.com/channel/0029Va8WpdlI1rchTrZU2O0l Telegram Group: t.me/ 4z-BZ2HuwHBmZDdl Discord Server: discord.gg/p3vtnzFbn5 Link to My Solution: leetcode.com/problems/count-vowel-strings-in-ranges/solutions/6218374/beginner-friendly-easy-to-understand-alg-jl69 Connect with Me on LinkedIn: ww...
LeetCode 1014 Best Sightseeing Pair | Array | DP | Asked in Google
Просмотров 254День назад
LeetCode Problem 1014. Best Sightseeing Pair [ 27 Dec 2024 ] 🔗 Resources & Links: WhatsApp Channel: whatsapp.com/channel/0029Va8WpdlI1rchTrZU2O0l Telegram Group: t.me/ 4z-BZ2HuwHBmZDdl Discord Server: discord.gg/p3vtnzFbn5 Link to My Solution: leetcode.com/problems/best-sightseeing-pair/solutions/6192756/easy-to-understand-100-java-c-python-detailed-video-explanation Connect with Me on LinkedIn...
LeetCode 2471 Minimum Number of Operations to Sort a Binary Tree by Level | Tree | Asked in Amazon
Просмотров 22214 дней назад
LeetCode Problem 2471. Minimum Number of Operations to Sort a Binary Tree by Level [ 23 Dec 2024 ] 🔗 Resources & Links: WhatsApp Channel: whatsapp.com/channel/0029Va8WpdlI1rchTrZU2O0l Telegram Group: t.me/ 4z-BZ2HuwHBmZDdl Discord Server: discord.gg/p3vtnzFbn5 Link to My Solution: leetcode.com/problems/minimum-number-of-operations-to-sort-a-binary-tree-by-level/solutions/6177337/easy-to-underst...
Started as a Tester and Made It to Developer at Google | ₹70 LPA 🔥 | Sahil Singla's Journey
Просмотров 1,9 тыс.14 дней назад
In this video, I interview Sahil Singla, a Software Engineer III at Google, earning ₹70 LPA. Sahil shares his inspiring journey from starting as a Tester to becoming a developer at Google. Learn about his challenges, strategies, and tips for transitioning into top tech roles. If you’re aiming to land your dream job in tech, this is a must-watch! 🔗 Resources & Links: WhatsApp Channel: whatsapp.c...
LeetCode 2872 Maximum Number of K Divisible Components | Tree | Hard | Asked in Google
Просмотров 24614 дней назад
LeetCode Problem 2872. Maximum Number of K-Divisible Components [ 21 Dec 2024 ] 🔗 Resources & Links: WhatsApp Channel: whatsapp.com/channel/0029Va8WpdlI1rchTrZU2O0l Telegram Group: t.me/ 4z-BZ2HuwHBmZDdl Discord Server: discord.gg/p3vtnzFbn5 Link to My Solution: leetcode.com/problems/maximum-number-of-k-divisible-components/solutions/6170621/100-faster-dfs-easy-intuitive-approach-j-9d0t Connect...
LeetCode 2415 Reverse Odd Levels of Binary Tree | Level Order | Asked in J P Morgan , Microsoft
Просмотров 33814 дней назад
LeetCode Problem 2415. Reverse Odd Levels of Binary Tree [ 20 Dec 2024 ] 🔗 Resources & Links: WhatsApp Channel: whatsapp.com/channel/0029Va8WpdlI1rchTrZU2O0l Telegram Group: t.me/ 4z-BZ2HuwHBmZDdl Discord Server: discord.gg/p3vtnzFbn5 Link to My Solution: leetcode.com/problems/reverse-odd-levels-of-binary-tree/solutions/6167116/easy-to-understand-level-order-traversal-kh8f Connect with Me on Li...
LeetCode 769 Max Chunks To Make Sorted | Monotonic | Greedy | Asked in Google
Просмотров 16221 день назад
LeetCode Problem 769. Max Chunks To Make Sorted [ 19 Dec 2024 ] 🔗 Resources & Links: WhatsApp Channel: whatsapp.com/channel/0029Va8WpdlI1rchTrZU2O0l Telegram Group: t.me/ 4z-BZ2HuwHBmZDdl Discord Server: discord.gg/p3vtnzFbn5 Link to My Solution: leetcode.com/problems/max-chunks-to-make-sorted/solutions/6162388/100-faster-easy-to-understand-java-c-pyt-jmhy Connect with Me on LinkedIn: www.linke...
LeetCode 1475 Final Prices With a Special Discount in a Shop | Monotonic Stack | Asked in Google, MS
Просмотров 22021 день назад
LeetCode Problem 1475. Final Prices With a Special Discount in a Shop [ 18 Dec 2024 ] 🔗 Resources & Links: WhatsApp Channel: whatsapp.com/channel/0029Va8WpdlI1rchTrZU2O0l Telegram Group: t.me/ 4z-BZ2HuwHBmZDdl Discord Server: discord.gg/p3vtnzFbn5 Link to My Solution: leetcode.com/problems/final-prices-with-a-special-discount-in-a-shop/solutions/6157961/easy-to-understand-monotonic-stack-java-o...
LeetCode 2182 Construct String With Repeat Limit | HashTable | Greedy | Asked in Microsoft
Просмотров 20321 день назад
LeetCode Problem 2182. Construct String With Repeat Limit [ 17 Dec 2024 ] 🔗 Resources & Links: WhatsApp Channel: whatsapp.com/channel/0029Va8WpdlI1rchTrZU2O0l Telegram Group: t.me/ 4z-BZ2HuwHBmZDdl Discord Server: discord.gg/p3vtnzFbn5 Link to My Solution: leetcode.com/problems/construct-string-with-repeat-limit/solutions/6156615/easy-to-understand-hashtable-step-by-step-detailed-video-explanat...
LeetCode 1749 Maximum Absolute Sum of Any Subarray | Kadane's Algorithm
Просмотров 27421 день назад
LeetCode Problem 1749 Maximum Absolute Sum of Any Subarray [ 16 Dec 2024 ] 🔗 Resources & Links: WhatsApp Channel: whatsapp.com/channel/0029Va8WpdlI1rchTrZU2O0l Telegram Group: t.me/ 4z-BZ2HuwHBmZDdl Discord Server: discord.gg/p3vtnzFbn5 Link to My Solution: leetcode.com/problems/maximum-absolute-sum-of-any-subarray/solutions/6152122/easy-to-understand-beginner-friendly-kadane-s-algo-variation-d...
LeetCode 3264 Final Array State After K Multiplication Operations I | Heap | Asked in Amazon
Просмотров 17621 день назад
LeetCode 3264 Final Array State After K Multiplication Operations I | Heap | Asked in Amazon
LeetCode 1792 Maximum Average Pass Ratio | Greedy | Heap | Asked in Amazon
Просмотров 25821 день назад
LeetCode 1792 Maximum Average Pass Ratio | Greedy | Heap | Asked in Amazon
LeetCode 2762 Continuous Subarrays | Variable Sliding Window | Asked in Google Amazon Adobe Uber
Просмотров 35921 день назад
LeetCode 2762 Continuous Subarrays | Variable Sliding Window | Asked in Google Amazon Adobe Uber
LeetCode 2593 Find Score of an Array After Marking All Elements | Sorting | HashTable | Visa
Просмотров 41328 дней назад
LeetCode 2593 Find Score of an Array After Marking All Elements | Sorting | HashTable | Visa
LeetCode 2558 Take Gifts From the Richest Pile | Easy | Heap | D E Shaw , Amazon , Bloomberg
Просмотров 15528 дней назад
LeetCode 2558 Take Gifts From the Richest Pile | Easy | Heap | D E Shaw , Amazon , Bloomberg
LeetCode 2779 Maximum Beauty of an Array After Applying Operation | Binary Search | Asked in Google
Просмотров 35428 дней назад
LeetCode 2779 Maximum Beauty of an Array After Applying Operation | Binary Search | Asked in Google
LeetCode 2981 Find Longest Special Substring That Occurs Thrice I | Google Interview Question
Просмотров 47928 дней назад
LeetCode 2981 Find Longest Special Substring That Occurs Thrice I | Google Interview Question
LeetCode 3152 Special Array II | Prefix Sum | Asked in NPCI Google Amazon
Просмотров 270Месяц назад
LeetCode 3152 Special Array II | Prefix Sum | Asked in NPCI Google Amazon
LeetCode 2054 Two Best Non Overlapping Events | Binary Search | Greedy | Razorpay Interview Question
Просмотров 475Месяц назад
LeetCode 2054 Two Best Non Overlapping Events | Binary Search | Greedy | Razorpay Interview Question
🚀 Walmart Interview Experience | From Amazon to Walmart SDE III at 2 YOE
Просмотров 849Месяц назад
🚀 Walmart Interview Experience | From Amazon to Walmart SDE III at 2 YOE
LeetCode 1760 Minimum Limit of Balls in a Bag | Binary Search on Answer Space | Amazon | Flipkart
Просмотров 391Месяц назад
LeetCode 1760 Minimum Limit of Balls in a Bag | Binary Search on Answer Space | Amazon | Flipkart
LeetCode 2554 Maximum Number of Integers to Choose From a Range I | Greedy | PayPal Interview Ques
Просмотров 178Месяц назад
LeetCode 2554 Maximum Number of Integers to Choose From a Range I | Greedy | PayPal Interview Ques
LeetCode 2337 Move Pieces to Obtain a String | String | Two Pointers | Google Amazon Interview Ques
Просмотров 382Месяц назад
LeetCode 2337 Move Pieces to Obtain a String | String | Two Pointers | Google Amazon Interview Ques
LeetCode 2825 Make String a Subsequence Using Cyclic Increments | String | Two Pointers | Amazon
Просмотров 227Месяц назад
LeetCode 2825 Make String a Subsequence Using Cyclic Increments | String | Two Pointers | Amazon
LeetCode 2109 Adding Spaces to a String | String | Easy | Two Pointers | Amazon Interview Question
Просмотров 220Месяц назад
LeetCode 2109 Adding Spaces to a String | String | Easy | Two Pointers | Amazon Interview Question
LeetCode 1455 Check If a Word Occurs As a Prefix of Any Word in a Sentence | String | Easy | Yelp
Просмотров 303Месяц назад
LeetCode 1455 Check If a Word Occurs As a Prefix of Any Word in a Sentence | String | Easy | Yelp

Комментарии

  • @naturesrevolution
    @naturesrevolution 18 часов назад

    Thanks alot 👍

  • @naturesrevolution
    @naturesrevolution День назад

    Thank you 👍

  • @naturesrevolution
    @naturesrevolution День назад

    Thank you for uploading the video in such a difficult situation.🫡

    • @CodeHarmonydev
      @CodeHarmonydev День назад

      Thank you! It was your motivation and support what pushed me. Truly grateful! :)

    • @naturesrevolution
      @naturesrevolution День назад

      @@CodeHarmonydev thanks alot 🙏

  • @naturesrevolution
    @naturesrevolution 2 дня назад

    Why no videos ?...

    • @CodeHarmonydev
      @CodeHarmonydev 2 дня назад

      Had an accident after new year celebration, stuck in hometown, car in workshop. Will continue from Monday most probably.

    • @naturesrevolution
      @naturesrevolution 2 дня назад

      @CodeHarmonydev oh!..ok be safe..take you're time and upload video slowly you're health is first priority...

  • @malleshm112
    @malleshm112 8 дней назад

    U provided solution giving compilation error how are you submit it..!?😊 Even if i correct the code it's failing for few testcases

    • @CodeHarmonydev
      @CodeHarmonydev 8 дней назад

      Which language did you use ? Java or some other ?

  • @motivemotion24
    @motivemotion24 10 дней назад

    Hello Bhaiya I Am A 1st Year BTech Student, According To Senior In My College There Is No On Campus Placement , I Am Feeling Very Tensed , What Should I Do From Now When I Watch RUclips Roadmap Everyone Talk About DSA , Should I Start From This Or Other ,l

    • @CodeHarmonydev
      @CodeHarmonydev 10 дней назад

      Thank you for your comment! Here's my advice to help you stay motivated and prepared for your journey: As a fresher, openings can be limited, so it's important to be open to all types of opportunities. This will ensure you don't feel demotivated and gain valuable experience. Different companies have varied requirements: Tier-1 (MAANG) companies focus heavily on problem-solving and system design. Tier-2 and startups may emphasize a mix of coding and practical development skills. Service-based (WITCH) companies often focus on foundational knowledge and communication skills. Being aware of this will help you tailor your approach for applications. To generalize your preparation, make sure you are strong in the basics of computer science: DBMS, OOPS, Operating Systems, and Computer Networks. One essential skill you need is problem-solving using Data Structures and Algorithms (DSA). Remember, this is a skill that develops over time, so start early and stay consistent. First, aim to familiarize yourself with the basic concepts of DSA and reach a level where you confidently understand every fundamental concept. As you progress, continue to raise your bar through preparation and consistent practice. If you still have any doubt feel free to book a call with me. All the best 👍

  • @raviprakash9215
    @raviprakash9215 16 дней назад

    Consistency is the key.

  • @rsKayiira
    @rsKayiira 17 дней назад

    Great explanation thank you

    • @CodeHarmonydev
      @CodeHarmonydev 16 дней назад

      Thanks, Glad you found it helpful! 😊

  • @deepaksurya2078
    @deepaksurya2078 17 дней назад

    do we do a level-order traveresal, store items at each level in an array, reverse the arrays in odd indices and finally merge all item to a new array?

    • @CodeHarmonydev
      @CodeHarmonydev 17 дней назад

      Yes , correct

    • @CodeHarmonydev
      @CodeHarmonydev 16 дней назад

      Reverse the array wont be the correct statement, in short we are trying to make array sorted by utilising swap operations. Given an array , do minimum number of swap operations on any two Indus to make the array sorted. This becomes our hidden problem inside this question. And the approach that we have to follow is to a rate over the array, and try to bring the exact value at the particular index. If the value is already correct, we don’t require a swap else we require one swap. I hope you got more clarity on this now . Let me know.

  • @chanderprakash5588
    @chanderprakash5588 17 дней назад

    Congretchulation Mr. Sahil Singla🎉🎉🎉🎉❤❤❤😊 god bless you 🕉️

  • @santoshmadam08
    @santoshmadam08 17 дней назад

    You are a very hard working boy, well done, may God bless you🎉🎉🎉🎉😊

  • @gunjanverma1850
    @gunjanverma1850 17 дней назад

    👏

  • @piyushgiri6736
    @piyushgiri6736 18 дней назад

    Inspiring journey.

  • @girlOnTheWheels
    @girlOnTheWheels 18 дней назад

    very hardworking boys

    • @CodeHarmonydev
      @CodeHarmonydev 18 дней назад

      Thank you so much for the kind words!

  • @amanchitkara752
    @amanchitkara752 18 дней назад

    Very inspiring Journey of Mr Sahil Singla congratulations 🎉🎉🎉🎉

  • @devmangrani1482
    @devmangrani1482 18 дней назад

    Great and Inspiring Journey you have shared Thank you so much for giving idea of how much important is the preparation for us in starting of the carrer I got so much inspiration from you and your podcasts Please bro keep doing it

    • @CodeHarmonydev
      @CodeHarmonydev 18 дней назад

      I'm so glad you found it inspiring! Thanks for the kind words. 😊

  • @chiraggarg96
    @chiraggarg96 18 дней назад

    Insightful

  • @naturesrevolution
    @naturesrevolution 19 дней назад

    Atleast need captions In english or enable translate option in you tube

    • @CodeHarmonydev
      @CodeHarmonydev 19 дней назад

      I really liked your suggestion about this youtube translate option, I'll definitely explore it. Also, I'll try to give subtitles from my next video. And thanks for your constant support!

    • @Ramu__1432
      @Ramu__1432 19 дней назад

      Thanks for responding the comments sir...​@@CodeHarmonydev

    • @vnkt_ayyappa
      @vnkt_ayyappa 19 дней назад

      You select captions options in that select auto translate to your understandable language

    • @naturesrevolution
      @naturesrevolution 19 дней назад

      @@CodeHarmonydev thank you 👍

    • @CodeHarmonydev
      @CodeHarmonydev 18 дней назад

      Caption auto translate has been enabled, kindly check once.

  • @downtowngedi
    @downtowngedi 20 дней назад

    😂😂😂

  • @a_mateur_photos
    @a_mateur_photos 21 день назад

    Glad you said the cheat days part highlighting the importance of practicality over perfection

  • @nikhilaggarwal9325
    @nikhilaggarwal9325 21 день назад

    great content

  • @MSDHONI-ne3uq
    @MSDHONI-ne3uq 21 день назад

    Great one sir

  • @LifeLogs-rm9cf
    @LifeLogs-rm9cf 22 дня назад

    This is really helpful. Thanks

  • @iftikarjahan4049
    @iftikarjahan4049 22 дня назад

    bro is soo honest....no hunger for fame....really inspiring

  • @HariomSahu-t7s
    @HariomSahu-t7s 24 дня назад

    explain very nicely

  • @krishani1000
    @krishani1000 24 дня назад

    Can we take the percentage of change instead of the diff between previous and the new pass ratio after adding one extra student?

    • @CodeHarmonydev
      @CodeHarmonydev 24 дня назад

      Yes we can, but calculating the percentage change is time taking operation for every step.

  • @siddarajhubballi598
    @siddarajhubballi598 24 дня назад

    Great Explaination. In the problem it is given that 1 < k <= 10, hence the brute force approach you explained becomes better If the k value is large then the optimal approach becomes better

    • @CodeHarmonydev
      @CodeHarmonydev 24 дня назад

      You're absolutely right! 👍 The problem constraints do make brute force viable in this case. Also, it's important to analyze the efficiency of different approaches as optimization can come as a follow up question in the interviews.

    • @siddarajhubballi598
      @siddarajhubballi598 23 дня назад

      @@CodeHarmonydev very true

  • @playroom0132
    @playroom0132 25 дней назад

    Very good and detailed explaination, and you do it with java, while nowadays mostly nowadays people do it with python. but language doesn't matter. understanding core intuition and idea behind it matters. One suggesstion. please turn on dark mode for leetcode. its hurts my eyes even I have turned on blue light filter, andits hard to watch for longer time. i usually watch Problem solving videos after work in evening/night.

    • @CodeHarmonydev
      @CodeHarmonydev 24 дня назад

      Thanks you for your kind words! :) I'll consider your suggestion about dark mode, thanks for the feedback!

  • @elakstein
    @elakstein 25 дней назад

    Very nicely explained. Thank you:)

    • @elakstein
      @elakstein 25 дней назад

      subscribed.

    • @CodeHarmonydev
      @CodeHarmonydev 24 дня назад

      Thanks, I’m really glad you liked it! 😊

  • @joshianurag6211
    @joshianurag6211 25 дней назад

    One of the worst explanations , can you please explain with Algorithm taking values.

    • @CodeHarmonydev
      @CodeHarmonydev 25 дней назад

      Hey! Could you please share more details why did you feel that way? I will try to clear your doubts or explain in details!

    • @joshianurag6211
      @joshianurag6211 24 дня назад

      @@CodeHarmonydev When approaching an algorithm, it's important to first explain the reasoning behind choosing a particular approach. Initially, one might consider the brute force method, which is straightforward but often inefficient for larger inputs. From there, we can move to a more optimized algorithm, such as one with a time complexity of O(n log K), which can handle larger datasets more efficiently. To illustrate the process, instead of just listing the subarrays, we can programmatically print each continuous subarray as it is identified by the algorithm. This not only highlights the theoretical choice of the algorithm but also provides a practical demonstration of its implementation.

    • @CodeHarmonydev
      @CodeHarmonydev 22 дня назад

      Thanks for your valuable feedback!

  • @LifeLogs-rm9cf
    @LifeLogs-rm9cf 25 дней назад

    Nice explanation!!

  • @prafulraghorte6189
    @prafulraghorte6189 25 дней назад

    Solve some questions from OA .

    • @CodeHarmonydev
      @CodeHarmonydev 25 дней назад

      I will try my best. Meanwhile, you can join the Discord community and discuss any specific question there. Thank you!

  • @MSDHONI-ne3uq
    @MSDHONI-ne3uq 26 дней назад

    Thank you for the explanation and code sir, it helped me a lot and was easy to understand

    • @CodeHarmonydev
      @CodeHarmonydev 26 дней назад

      Glad you found it helpful! 😊 and Thank you so much for your kind words !

  • @girlOnTheWheels
    @girlOnTheWheels 26 дней назад

    very informativr

  • @joshianurag6211
    @joshianurag6211 27 дней назад

    You must have explained with more minute details. Like why binary search is used here and what are the other approaches.

    • @CodeHarmonydev
      @CodeHarmonydev 26 дней назад

      I understand the need for detailed explanations, I'll definitely consider your feedback for future videos! :) Thanks

  • @himanshu788
    @himanshu788 27 дней назад

    really liked your approach and explanation sir

    • @CodeHarmonydev
      @CodeHarmonydev 27 дней назад

      Thanks for your kind words, I appreciate it! 🙏 😊

  • @chiraggarg96
    @chiraggarg96 28 дней назад

    😂😂😂

  • @downtowngedi
    @downtowngedi 28 дней назад

    😂😂

  • @rizwansworld
    @rizwansworld 29 дней назад

    Well explained. Thanks man.

  • @chanderprakash5588
    @chanderprakash5588 Месяц назад

    ❤❤❤❤❤😊

  • @piyushgiri6736
    @piyushgiri6736 Месяц назад

    Very insightful

  • @raviprakash9215
    @raviprakash9215 Месяц назад

    Excellent explanation. Can you please help me with this code? It runs well while memoization is not added and throws TLE, but after adding memoization, the code starts to throw an error. Thanks in advance. public int solve(int[][] events, int index, int lastTime, int count, int[][] dp) { if (index >= events.length || count <= 0) { return 0; } if (dp[index][count - 1] != -1) { return dp[index][count]; } int include = 0; if (lastTime < events[index][0]) { include = events[index][2] + solve(events, index + 1, events[index][1], count - 1, dp); } int notInclude = solve(events, index + 1, lastTime, count, dp); return dp[index][count - 1] = Math.max(include, notInclude); } public int maxTwoEvents(int[][] events) { Arrays.sort(events, Comparator.comparingInt(a -> a[0])); int[][] dp = new int[events.length][2]; for (int[] temp : dp) { Arrays.fill(temp, -1); } solve(events, 0, 0, 2, dp); return Math.max(dp[0][0], dp[0][1]); }

    • @CodeHarmonydev
      @CodeHarmonydev Месяц назад

      Need to check the code, bro. One thing i can see is that. if (dp[index][count - 1] != -1) { return dp[index][count]; } if you're checking for count-1 u should return count-1. also dp is not tracking all the parameters. Whatever are the dynamic parameters in the sol or helper function we have to memorize against them. if there are 3 non constant variable then memorized against all. dp[index][lastTime][count]

  • @naturesrevolution
    @naturesrevolution Месяц назад

    Sir english pls...

    • @CodeHarmonydev
      @CodeHarmonydev 21 день назад

      Thank you for your comment! I usually keep my educational videos in English, but for interviews, I go with the language the interviewee is most comfortable with. If someone prefers Hindi, I follow their preference. I’ll try to balance this better in the future! :)

    • @MrK-nb7xr
      @MrK-nb7xr 14 дней назад

      No kannada ... Only hindi

  • @devmangrani1482
    @devmangrani1482 Месяц назад

    Great Advise you have share for Freshers So Informative video Please bring more this type of videos So, Freshers like us can improve and inspire from you Thank You So much Sahil Sir..................

    • @CodeHarmonydev
      @CodeHarmonydev Месяц назад

      Thank you so much for your kind words! I'm glad you found the video helpful. I'll definitely keep sharing more such content to support freshers like you. Best of luck on your journey! 😊

  • @LifeLogs-rm9cf
    @LifeLogs-rm9cf Месяц назад

    Informative!

  • @parthbhoi7390
    @parthbhoi7390 Месяц назад

    Bro, you are so inspiring, I literally watched this live 🔥🔥

  • @bhavyaganatra8842
    @bhavyaganatra8842 Месяц назад

    Shyam is on the roll. Way to go 🔥🔥

  • @Giggle_corner
    @Giggle_corner Месяц назад

    Great explanation. I need some help here. I was able to pick up the approach when you said binary search. But how to come to that conclusion after seeing a question. I was trying to find the approach but couldn't figure binary search would do this. How to arrive at that conclusion that binary search would do it.

    • @CodeHarmonydev
      @CodeHarmonydev Месяц назад

      Thanks for your comment! 😊 To identify: 1️⃣ Try solving sample examples manually-you’ll notice answers are in a range. 2️⃣ Look for monotonic properties (e.g., if one size works, larger/smaller ones might too). 3️⃣ Check out this video for more on such problems: ruclips.net/video/WBm6xyAZHdo/видео.html. Practice will make it easier to spot these patterns. Let me know if you need more help.