LEETCODE 112 (JAVASCRIPT) | PATH SUM
9:46
LEETCODE 78 (JAVASCRIPT) | SUBSETS I
13:51
LEETCODE 90 (JAVASCRIPT) | SUBSETS II
12:26
Пікірлер
@ELAAD2408
@ELAAD2408 Күн бұрын
best teacher for leetcode in youtube
@Fido1hn
@Fido1hn 2 күн бұрын
Thanks so much
@Probablyaliq4
@Probablyaliq4 7 күн бұрын
Thank you very much
@izazk
@izazk 17 күн бұрын
Simple solution: /** * @param {number[]} nums * @param {number} k * @return {void} Do not return anything, modify nums in-place instead. */ var rotate = function (nums, k) { k = k % nums.length; nums = nums.slice(-k).concat(nums.slice(0, -k)); };
@Codingchess-rw7sp
@Codingchess-rw7sp 18 күн бұрын
Please continue the series sir more leetcode solution please
@viralpasad5222
@viralpasad5222 22 күн бұрын
I wish the helper functions would've been explained more, you just built upon the fact that everyone has read the book.
@thiernodem5681
@thiernodem5681 27 күн бұрын
I understands codes more when it's been coded than explained on paper or board. You explained it very well, and it's actually easy to comprehend. Thank you!
@Taiwaneze
@Taiwaneze Ай бұрын
thats was soo poorly explained
@rehamgamal1722
@rehamgamal1722 Ай бұрын
the audio is so low I can't hear you. but great job!
@itsokaytobesergey
@itsokaytobesergey 2 ай бұрын
left + (right - left) === right
@muhammednehyan5443
@muhammednehyan5443 3 ай бұрын
great explanation
@rrl9786
@rrl9786 3 ай бұрын
Man, thank you so much. I am beginning to get pretty comfortable with linked lists, but this problem turned my brain into mush and I finally decided it was better to just see it demonstrated and then use that knowledge in future problems. Your explanation was so clear and concise, I finally actually understand this fully.
@TheKylesampson
@TheKylesampson 3 ай бұрын
Best vid I found today for understanding quick sort. Thank you!
@sportsmanship2024
@sportsmanship2024 3 ай бұрын
I hardly heard your voice, I don't know if it is from your microphone or you are not speaking louder...
@SouravCheck
@SouravCheck 3 ай бұрын
hello, /** * @param {string} s * @return {boolean} */ var isValid = function(s) { let input=s.split(""); let count=0; for(let i=0;i<input.length;i++) { for(let j=i+1;j<input.length;j++) { if(input[i]=='('&& input[j]==')' || input[i]=='[' && input[j]==']' || input[i]=='{'&& input[j]=='}') { count++; } if( input[i]=='(' && input[j+1]==')' || input[i]=='{' && input[j+1]=='}' ||input[i]=='[' && input[j+1]==']') { return false; } } } if((count*2)==input.length) { return true; } else { return false; } };
@SouravCheck
@SouravCheck 3 ай бұрын
why it is not running.....................
@Ly-fj3dq
@Ly-fj3dq 4 ай бұрын
thank you so much for this video!!!! helps me a lot
@Big_13ang
@Big_13ang 4 ай бұрын
👌👌
@peterlazkweb9111
@peterlazkweb9111 4 ай бұрын
Nice video 🤗, just that the sound wasn't clear enough
@maxwong4657
@maxwong4657 4 ай бұрын
Thank you so much. This solution is the most understandable!
@josygeorge5671
@josygeorge5671 4 ай бұрын
the 3rd example doesn't work, but needs an absolute value comparison in the diff calculation(values with less than zero)
@HasmeRafsanjani
@HasmeRafsanjani 5 ай бұрын
Nice Explanation but your video sound is too low .
@nandakumart2331
@nandakumart2331 5 ай бұрын
thank you
@pranavbhat92
@pranavbhat92 5 ай бұрын
Thank you. Your explanation felt intuitive!
@stevemiller123
@stevemiller123 5 ай бұрын
It seems there's no need to include 0 in your reducer. The method will still properly add up all your vaules.
@joshluca763
@joshluca763 5 ай бұрын
Very solid explanation. Much appreciated!
@jamesbond86
@jamesbond86 5 ай бұрын
Great Job! Love your content
@enriquegrageda
@enriquegrageda 6 ай бұрын
Had to watch it 3 times, it makes sense, thanks for making this video!
@jillysong4751
@jillysong4751 6 ай бұрын
What if all values in first array are greater than those in second array and the first pointer goes out of range first?
@ethaneth6481
@ethaneth6481 6 ай бұрын
Your explaination is very incomplete, you totally skip explaining the update part.
@michaelesparza7917
@michaelesparza7917 6 ай бұрын
you lost me on this one bro
@chandansingh-sb3il
@chandansingh-sb3il 6 ай бұрын
for (let r = 0; r < matrix.length; r++) { for (let c = r; c < matrix[0].length; c++) { [matrix[c][r],matrix[r][c]] = [matrix[r][c],matrix[c][r]] } } Why this is generating error in leetcode IDE but runs in jsfiddle
@OnkarJoshi422
@OnkarJoshi422 6 ай бұрын
Time complexity for this one is O(n*2) because Array.prototype.reverse has O(n) and next two reversals have k and n - k combined O(n) and all combined O(n*2). To make it O(n), we can use the same revNums function for whole array reverse as well.
@user-pm2kx1vi1e
@user-pm2kx1vi1e 7 ай бұрын
var levelOrder = function(root) { if(!root) return []; let queue = [root]; let result = []; while(queue.length){ let len = queue.length; result.push(queue.map(node => node.val)); while(len--){ let node = queue.shift();// for(let child of node.children){ queue.push(child) } } } return result; };
@michaelesparza7917
@michaelesparza7917 7 ай бұрын
ummmmmm but the last one doesn't make a region it just makes a 3rd branch from node one. IM so confused
@user-pm2kx1vi1e
@user-pm2kx1vi1e 7 ай бұрын
/** * Definition for a binary tree node. * function TreeNode(val, left, right) { * this.val = (val===undefined ? 0 : val) * this.left = (left===undefined ? null : left) * this.right = (right===undefined ? null : right) * } */ /** * @param {TreeNode} root * @param {number} targetSum * @return {number[][]} */ var pathSum = function(root, targetSum) { if(!root) return []; const paths=[]; const dfs = (node, sum, slate) => { if(node.left === null && node.right === null){ if(sum === node.val){ slate.push(node.val); paths.push(slate.slice()); slate.pop(); } } if(node.left){ slate.push(node.val); dfs(node.left, sum - node.val, slate); slate.pop(); } if(node.right){ slate.push(node.val); dfs(node.left, sum - node.val, slate); slate.pop(); } } dfs(root, targetSum, []); return paths; };;
@akinhwan
@akinhwan 7 ай бұрын
these videos are a life saver thanks andy
@hassaniyouness8024
@hassaniyouness8024 7 ай бұрын
the content is great hope you get back soon
@akash693
@akash693 8 ай бұрын
Well explained!
@Ivan_Dev
@Ivan_Dev 8 ай бұрын
Can anyone tell me which 'drawing' software is he using plz?
@arromero491
@arromero491 8 ай бұрын
Thanks a lot, I understand everthing!
@codingispower1816
@codingispower1816 9 ай бұрын
This problem is so confusing even with this great explanation. i,j i-1, j-1 haha I need to slowly repeat this vid
@zscoder
@zscoder 9 ай бұрын
Where do we start with your DSA videos?
@user-xn3ff2sf7q
@user-xn3ff2sf7q 9 ай бұрын
Thanks for your insight and good content.
@nicknderitu6013
@nicknderitu6013 9 ай бұрын
You could also use a map for parens which I feel is more intuitive. Here's a solution I found easier to understand. /** * @param {string} s * @return {boolean} */ var isValid = function (s) { //handle the edge case //create a map holding the opening brackets macthed to the closing bracket //create a stack to hold the opening bracket //loop through s and check if the bracket in the stack matches the current bracket //if not push item to the stack //if stack is empty return true else false if (s.length % 2 != 0) return false; const map = { "(": ")", "[": "]", "{": "}" } const stack = []; stack.push(s[0]); for (let i = 1; i < s.length; i++) { let stackEl = stack[stack.length - 1]; if (map[stackEl] == s[i]) { stack.pop(); } else { stack.push(s[i]); } } return stack.length == 0; };
@UmaSahni.
@UmaSahni. 9 ай бұрын
blessed with your explanation !!
@natebland4066
@natebland4066 9 ай бұрын
I appreciate that you kept the debuggining process in. Makes me feel better about making mistakes :)
@TeeJay327-yg8gm
@TeeJay327-yg8gm 9 ай бұрын
Simply brilliant! Extremely intuitive and easy to remember - thanks so much for this and many of your other videos, Andy!
@Digitalkmusicproduction
@Digitalkmusicproduction 9 ай бұрын
I think line 19 the else statement could be removed, because if the value is more than one the while loop wouldn't run, so it would never see it. Right? or am I missing something? great video btw
@darshanakv4946
@darshanakv4946 9 ай бұрын
I have been trying a code using 2 for loops but somehow the output is not coming in the code editor of leet code but in the chrome console,it is coming as expected. Any help?
@mukulgaddhyan3954
@mukulgaddhyan3954 5 ай бұрын
It is exceeding the suggested time limit in leetcode, hence it won't run for a few large input data.
@mukulgaddhyan3954
@mukulgaddhyan3954 5 ай бұрын
I am assuming your code looks something like this:- for(let i=1; i<=k; i++){ for(let j=0; j<nums.length; j++){ let temp = nums[j]; nums[j] = nums[0]; nums[0] = temp; if(j==nums.length) nums[0]=nums[j]; } }
@sianwa11
@sianwa11 10 ай бұрын
Thanks for the explanation. I initially started using a linked list stack and it got way too complicated. This solution is great👍🏾