JSDev
JSDev
  • 18
  • 20 901
150. Evaluate Reverse Polish Notation, Leetcode Javascript Solution
Leetcode interview question 150. Evaluate Reverse Polish Notation. Solution is written in Javascript with clear explanation. This question can be resolved using stacks. #leetcode #neetcode #javascript #interview
มุมมอง: 70

วีดีโอ

15. 3Sum Leetcode Javascript Solution
มุมมอง 975ปีที่แล้ว
Leetcode Interview question 15. 3Sum #Javascript solution. #leetcode #neetcode
167. Two Sum II - Input Array Is Sorted, Leetcode Javascript Solution
มุมมอง 313ปีที่แล้ว
Leetcode Interview question 167. Two Sum II - Input Array Is Sorted, #Javascript solution. #leetcode #neetcode
125 Valid Palindrome, Leetcode Javascript Solution
มุมมอง 2.1Kปีที่แล้ว
Leetcode Interview question 125. Valid Palindrome, #Javascript solution. #leetcode #neetcode
238 Product of Array Except Self (O(n) space)
มุมมอง 73ปีที่แล้ว
Leetcode Interview question 238. Product of Array Except Self, #Javascript solution. This is a follow up to the below. In this video's solution, we are solving it using O(n) space. #leetcode #neetcode th-cam.com/video/dhRHRHKC524/w-d-xo.html
49. Group Anagrams, Intuitive Leetcode Javascript Solution Walkthrough
มุมมอง 512ปีที่แล้ว
Leetcode interview question 49. Group Anagrams, Javascript solution. 1. The idea here is to iterate through all the strings 2. At each element, sort it alphabetically, this will be the key to your anagram bucket. 3. If key exists, we push into the bucket, if not, we create a new bucket with the current element. #leetcode #javascript #interview
Quickly Learn How to use useCallback in React
มุมมอง 40ปีที่แล้ว
Quickly grasp how to use React's useCallback hook. Things to remember: we always need to use React.memo and React.useCallback together, otherwise React.useCallback won't have the intended effect. #frontenddeveloper #React #reacthooks
How to use React.useMemo
มุมมอง 26ปีที่แล้ว
How to use React.useMemo and be prepped for your next interview or use it in your next app. #react #frontenddeveloper #javascript
Quickly learn React's useState( ). Practical examples.
มุมมอง 103ปีที่แล้ว
Learn React.useState in 8 minutes. This video will help you nail your frontend interview. The video goes through how to use React.useState(), and all the ways you might want to update the state. For example, incrementing a value, modifying an array or object. #react #frontenddeveloper #javascript The example we use is below: codesandbox.io/s/usestate-example-u7ny2j 00:00 - Intro 1:10 - Incremen...
217. Contains Duplicate LeetCode Javascript Solution
มุมมอง 2892 ปีที่แล้ว
#leetcode #javascript #codinginterview 217. Contains Duplicate Leetcode Javascript Solution Full solution here github.com/rikotacards/algos/blob/main/leet/242ValidAnagram/242ValidAnagram.js
When to use "=" in binary search condition?
มุมมอง 2.9K2 ปีที่แล้ว
It may be confusing as to when to use = in binary search. Or, when to use the less-than, or less-than-equal signs. This video clarifies that, provided we are trying to determine if a value exists or not in the array. #javascript #binarysearch #leetcode
Product of Array Except Self Javascript Solution, LeetCode 238
มุมมอง 2.9K2 ปีที่แล้ว
Leetcode interview question Product of Array Except Self, Javascript solution. If you guys find the deck helpful and want them, let me know in the comments below. #leetcode #javascript #interview #codingInterview
Top K Elements Javascript Solution LeetCode 347
มุมมอง 2.2K2 ปีที่แล้ว
Leetcode interview question Top K Elements, Javascript solution. If you guys find the deck helpful and want them, let me know in the comments below. This solution uses a bucket sort which I found quite intuitive vs a heap. #leetcode #javascript #interview
1.Two Sum Leetcode Javascript Solution
มุมมอง 8242 ปีที่แล้ว
Leetcode interview question 1. Two Sum, Javascript solution. If you guys find the deck helpful and want them, let me know in the comments below. #leetcode #javascript #interview
128. Longest Consecutive Sequence - LeetCode Javascript Solution
มุมมอง 2.5K2 ปีที่แล้ว
Leetcode interview question128. Longest Consecutive Sequence, Javascript solution. If you guys find the deck helpful and want them, let me know in the comments below. #leetcode #javascript #interview
796 Rotate String Leetcode Javascript Solution - Blind 75
มุมมอง 4302 ปีที่แล้ว
796 Rotate String Leetcode Javascript Solution - Blind 75
242. Valid Anagram LeetCode Javascript Solution
มุมมอง 3.4K2 ปีที่แล้ว
242. Valid Anagram LeetCode Javascript Solution
56. Merge Intervals Leetcode JavaScript Solution
มุมมอง 1.2K2 ปีที่แล้ว
56. Merge Intervals Leetcode JavaScript Solution

ความคิดเห็น

  • @NeerajSingh-it3sm
    @NeerajSingh-it3sm 26 วันที่ผ่านมา

    function test(nb, final) { for (let i = 0; i < nb.length; i++) { for (let j = i + 1; j < nb.length; j++) { if (nb[i] + nb[j] === final) { return [i, j]; } } } } console.log(test([2, 7, 11, 15], 9));

  • @AnilKumar-re5mu
    @AnilKumar-re5mu 3 หลายเดือนก่อน

    class Solution { /** * @param {string} s * @param {string} t * @return {boolean} */ isAnagram(s, t) { if(s.length !== t.length) return false; let map = {}; for(let i=0; i<t.length; i++){ map[s[i]] = !Boolean(map[s[i]]); map[t[i]] = !Boolean(map[t[i]]); } console.log(map) for(const key in map){ if(map[key] === true) return false } return true; } } Can anyone help me with the test case for which it is failing?

  • @FreeDomSy-nk9ue
    @FreeDomSy-nk9ue 3 หลายเดือนก่อน

    right++?? Come on man...

  • @alperkaya8919
    @alperkaya8919 3 หลายเดือนก่อน

    I think you wrote left++ and right++ part wrong, this algorithm would work in O(N) time whereas binary search is O(logN). You need to skip half of the remaining values each iteration to call it binary search, but you are skipping only 1 value each iteration.

  • @it-041-satheeshkumar.k7
    @it-041-satheeshkumar.k7 4 หลายเดือนก่อน

    Thanks for this explanation

  • @HamzahAhmad-db5cy
    @HamzahAhmad-db5cy 4 หลายเดือนก่อน

    This was the best explanation I could find about 3sum on youtube. Thank you for the effort

  • @shivambhagat2540
    @shivambhagat2540 4 หลายเดือนก่อน

    the solution gave an error says string.split isnt a function?

  • @enriquegrageda
    @enriquegrageda 5 หลายเดือนก่อน

    You the best bro 😃

  • @Dstoic
    @Dstoic 5 หลายเดือนก่อน

    this was really great

  • @waleedahmed152
    @waleedahmed152 6 หลายเดือนก่อน

    It’s in the if statement

  • @felixferreras4125
    @felixferreras4125 7 หลายเดือนก่อน

    Good Explanation ! I highly encourage you to continue to make videos !

  • @BaoNguyen-uh5hy
    @BaoNguyen-uh5hy 8 หลายเดือนก่อน

    if is o(n) but if plus else is o(n^2) no? don't we need to keep it o(n)?

    • @BaoNguyen-uh5hy
      @BaoNguyen-uh5hy 8 หลายเดือนก่อน

      and any loop itself is already o(n) so adding any other loop or conditions inside of them will just breaks the rule?

  • @HeejinSon-d5k
    @HeejinSon-d5k 8 หลายเดือนก่อน

    Typo in the code. Not right++ right -

  • @murike
    @murike 9 หลายเดือนก่อน

    you need to update pointers too mid + 1, mid - 1. not just increment/decrement them

  • @Harish-bl9gv
    @Harish-bl9gv 11 หลายเดือนก่อน

    where is JSDev waiting for his video since 9 months

    • @jsdev6744
      @jsdev6744 10 หลายเดือนก่อน

      haha I appreciate the support - been a bit crammed but I'm hoping to get back to it asap.

  • @vogevei
    @vogevei ปีที่แล้ว

    I didn’t check but at first glance, the bug is in line 16 - should be intervals[i][0]. Also I’m not sure if you need to take a min at line 17 since you already sorted the array

  • @stephenromero8777
    @stephenromero8777 ปีที่แล้ว

    This is a great solution, but I would ask to add time and space complexity of this solution as well.

  • @piratejing
    @piratejing ปีที่แล้ว

    isnt the solution suppose to be [2,3] not [2,4] in your example of 1 2 3 4

  • @jacobd.chamberlain2674
    @jacobd.chamberlain2674 ปีที่แล้ว

    How is this O(n) with the nested while loop? Is it because this would technically be O(n * m) where n is the length of nums and m is the longest possible sequence, and m will always be less than or equal to n so it's negligible to O(n) ? Couldn't this be O(n^2) if all numbers in nums are sequential? Am I close or way off?

  • @Shakhzod_Yuldoshov
    @Shakhzod_Yuldoshov ปีที่แล้ว

    very good explanation and solution thank you

  • @JamieDawsonCodes
    @JamieDawsonCodes ปีที่แล้ว

    Normally I like it when people type out the code while explaining it. But I actually found it being pre-written easier to wrap my heard around. Seeing you write out comments with the data structures and how they're built with the code right next to it made the concepts a breeze to understand. Thanks for making this video! It's one of the questions I struggled with for Blind75

    • @jsdev6744
      @jsdev6744 ปีที่แล้ว

      Thank you for that !

  • @uchennaonwuliri4856
    @uchennaonwuliri4856 ปีที่แล้ว

    how is s.length not throwing an error? isn't that a string? please explain

    • @jsdev6744
      @jsdev6744 ปีที่แล้ว

      you can do .length for strings as well as arrays.

  • @usenavigate4060
    @usenavigate4060 ปีที่แล้ว

    thank you so much for this and damn you have the best voice

  • @OrrisBond
    @OrrisBond ปีที่แล้ว

    Nice

  • @ivanryduch5084
    @ivanryduch5084 ปีที่แล้ว

    why is it so difficult ? here is my solution var productExceptSelf = function(nums) { let result = []; for (let i =0; i < nums.length; i++) { result[i] = nums.reduce((acc, item, index) => { if (index !== i) { acc *= item } return acc }, 1) } return result };

    • @mareenasavelieva
      @mareenasavelieva ปีที่แล้ว

      this solution is ok but it's too time consuming and on huge amounts of data it will give you Time Limit Exceeded Error

  • @SethuSenthil
    @SethuSenthil ปีที่แล้ว

    this is what i needed!

  • @dmitryk.803
    @dmitryk.803 ปีที่แล้ว

    0:25 [1,10,80,48] is not sorted even tho you say it is... 1:10 right-- instead of right++

  • @seth_king_codes
    @seth_king_codes ปีที่แล้ว

    would this approach work for two sum in general, not just sorted? I'll need to try for myself...but maybe?

  • @nikakondra5321
    @nikakondra5321 ปีที่แล้ว

    Thank you so much :)

  • @helpfulprogrammer
    @helpfulprogrammer ปีที่แล้ว

    awesome explanation) thanks

  • @Vivek-Nishad
    @Vivek-Nishad ปีที่แล้ว

    function sortArrays(arr) { return arr.sort((a, b) => a[0] - b[0]); } function mergeIntervals(arr) { let newArr = [arr[0]]; for (const [start, end] of arr) { let lastEnd = newArr.at(-1)[1]; if (start <= lastEnd) { newArr.at(-1)[1] = Math.max(lastEnd, end); } else { newArr.push([start, end]); } } return newArr; } let sortedArr = sortArrays(arr); let result = mergeIntervals(sortedArr); console.log(result);

  • @VaibhavPrasad
    @VaibhavPrasad ปีที่แล้ว

    Very Nice explanation!

    • @HuyNguyen-zp8ju
      @HuyNguyen-zp8ju ปีที่แล้ว

      too easy to search for solution, are you serious ?

    • @RyansVlogs757
      @RyansVlogs757 9 หลายเดือนก่อน

      then why are you here@@HuyNguyen-zp8ju

  • @Hariharan0606
    @Hariharan0606 ปีที่แล้ว

    Amazing explanation !!

  • @SeanPham-v9t
    @SeanPham-v9t ปีที่แล้ว

    I dont get the l+1 and r+1 and you help me explain it a little bit more.

    • @jsdev6744
      @jsdev6744 ปีที่แล้ว

      Hey, great question. So this question is saying "Given a 1-indexed array". Therefore we return l+1, and r+1, instead of r and l. If we just returned l, r, without the "+1" that would be a 0-indexed array. (Something we are more familiar with) But instead, we want to return a 1 indexed array, therefore, we just add 1 to the final result, and return that. Does that clarify?

    • @SeanPham-v9t
      @SeanPham-v9t ปีที่แล้ว

      @@jsdev6744 thank you so much man and your videos are fire 🔥🔥🔥🔥🔥

    • @jsdev6744
      @jsdev6744 ปีที่แล้ว

      @@SeanPham-v9t Happy to help :)

  • @idcemail123
    @idcemail123 ปีที่แล้ว

    Nice helped me understand it, but when do you use 'less than/<' without <=?

  • @bharathd149
    @bharathd149 ปีที่แล้ว

    Can someone plz help with the Time and Space complexity for this solution .. Thanks in Advance ..

  • @sergiyrudenko905
    @sergiyrudenko905 ปีที่แล้ว

    Great video! Thank you!

  • @sergiyrudenko905
    @sergiyrudenko905 ปีที่แล้ว

    Thank you! Very helpful video! Please continue to make more videos like this! I watched your solution and modified it a bit. It has less code, but I'm not sure if it is more efficient. Can I have your feedback, please? function topKFrequent(nums: number[], k: number): number[] { let count = {} for(const number of nums){ if(count[number] === undefined){ count[number] = 1 } else { count[number]++ } } const keysSorted = Object.keys(count).sort((a,b)=> count[b] - count[a]) return Array.from(keysSorted.slice(0, k), Number); };

  • @JChamberslam
    @JChamberslam ปีที่แล้ว

    I prefer an explanation of the approach first with no code, then showing the code afterward, so I can try to code it out on my own first and then look for mistakes I've made if I can't get it to work, or more efficient ways to do it. Regardless, thank you for this explanation! It helped me understand bucket sort much clearer than previous explanations so far.

    • @jsdev6744
      @jsdev6744 ปีที่แล้ว

      Glad it helped! Sorry for the late reply been inactive for a while. But I'm back!

  • @ikidtech
    @ikidtech ปีที่แล้ว

    live code and explaining is cool!

    • @jsdev6744
      @jsdev6744 ปีที่แล้ว

      Noted! Interesting. Because I actually prefer to learn by seeing the code and have someone explain it to me.

  • @gioiacobucci
    @gioiacobucci 2 ปีที่แล้ว

    Cliffhanger ending

    • @katherinecontreras
      @katherinecontreras ปีที่แล้ว

      seriously lmao

    • @abhinavsingh7152
      @abhinavsingh7152 ปีที่แล้ว

      code is working fine must be a glitch

    • @jsdev6744
      @jsdev6744 ปีที่แล้ว

      Loool, I just saw this comment and went back to the video. Sorry about that haha but thanks for pointing it out! 😅

  • @elipeer6282
    @elipeer6282 2 ปีที่แล้ว

    Shouldn't i = 0?

    • @abhinavsingh7152
      @abhinavsingh7152 ปีที่แล้ว

      already added zero indexed array in result so no need to start from 0

  • @yunus7489
    @yunus7489 2 ปีที่แล้ว

    Your explanation of the solution is very good and understandable. Please keep making videos.

  • @katerinakreibich8484
    @katerinakreibich8484 2 ปีที่แล้ว

    Great video explanation. Thank you!

  • @UserYoutube4321
    @UserYoutube4321 2 ปีที่แล้ว

    Best video explenation I have seen for this problem. Time complexity and space would be a nice discussion as well.

  • @jenso413
    @jenso413 2 ปีที่แล้ว

    FOR ANYONE TRYING TO USE ARRAY.FILL() INSTEAD OF A FOR LOOP TO FILL THE BUCKET: THIS IS WHY IT DOESN'T WORK I was so frustrated after basically copying this code, but thinking "oh, I can just use Array(nums.length + 1).fill([]) instead of iterating and adding an empty array, it'll be more concise", and it wouldn't work. I found after opening vscode and console logging some stuff that every array in my "bucket" was getting filled with each and every number. This is why: Array.fill() populates each index with the SAME element. If that element is an object/array, it is passed by reference, not value. This means that it is not giving you x unique arrays for the bucket, but 8 arrays that all reference the same array in memory. That is why when you then add elements to your buckets, it actually is adding to every array in that bucket (since it all points to the same array). So long story short, just copy this guys code, it works lol. Rant aside, thanks for the video!

    • @JChamberslam
      @JChamberslam ปีที่แล้ว

      Lol, I did the same thing, I was like WHY YOU NO- anyway I was wondering what the reason was behind this, thank you for the explanation!

    • @jenso413
      @jenso413 ปีที่แล้ว

      @@JChamberslam haha no problem, I remember it frustrated the hell outta me so I’m glad I was able to help

    • @antwanwimberly1729
      @antwanwimberly1729 ปีที่แล้ว

      Oh wow. I thought of using Array.fill as well

  • @yuanliu5945
    @yuanliu5945 2 ปีที่แล้ว

    So helpful!! Can't wait to see the next video

  • @3pleFly
    @3pleFly 2 ปีที่แล้ว

    That's really a good solution and I liked your explanation

  • @samanthalivengood2690
    @samanthalivengood2690 2 ปีที่แล้ว

    I liked the walkthrough! What is the big O for this?

    • @jsdev6744
      @jsdev6744 2 ปีที่แล้ว

      Someone correct me if I'm wrong, but time is O(n), since at most we are iterating through a loop (no nested loops), space complexity is also O(n), we are creating a hashmap based off of the input array length. If we want to be more specific, 3* O(n), for the seen hashmap, bucket list, and result.

    • @samanthalivengood2690
      @samanthalivengood2690 2 ปีที่แล้ว

      @@jsdev6744 Thank you!

  • @sayan1193
    @sayan1193 2 ปีที่แล้ว

    Understood the solution properly, thanks!

    • @jsdev6744
      @jsdev6744 2 ปีที่แล้ว

      Glad it helped!