![Udyan is here](/img/default-banner.jpg)
- 31
- 10 528
Udyan is here
India
Registrace 26. 04. 2015
Hello! My name is Udyan, Finding way in tech and making learning fun.
779. K-th Symbol in Grammar | O(N) | Java | Hindi
In this video, we'll tackle question number 779. K th Symbol in Grammar on Leetcode using Java. The explanation will be provided in Hindi for easy understanding.
You can find the problem link in the First Comment.
If you have any questions or need further assistance, please don't hesitate to reach out to me through my Linktree profile: linktr.ee/udyanojha
You can find the problem link in the First Comment.
If you have any questions or need further assistance, please don't hesitate to reach out to me through my Linktree profile: linktr.ee/udyanojha
zhlédnutí: 217
Video
515. Find Largest Value in Each Tree Row
zhlédnutí 49Před 10 měsíci
In this video, we'll tackle question number 515. Find Largest Value in Each Tree Row on Leetcode using Java. The explanation will be provided in Hindi for easy understanding. If you have any questions or need further assistance, please don't hesitate to reach out to me through my Linktree profile: linktr.ee/udyanojha
341. Flatten Nested List Iterator | Medium | Recursion | Java | Hindi
zhlédnutí 59Před 10 měsíci
In this video, we'll tackle question number 341. Flatten Nested List Iterator on Leetcode using Java. The explanation will be provided in Hindi for easy understanding. You can find the problem link here: leetcode.com/problems/flatten-nested-list-iterator/ If you have any questions or need further assistance, please don't hesitate to reach out to me through my Linktree profile: linktr.ee/udyanojha
1361. Validate Binary Tree Nodes | Medium | Memoization | Java | Hindi
zhlédnutí 102Před 10 měsíci
In this video, we'll tackle question number 1361. Validate Binary Tree Nodes on Leetcode using Java. The explanation will be provided in Hindi for easy understanding. You can find the problem link here: leetcode.com/problems/validate-binary-tree-nodes/ If you have any questions or need further assistance, please don't hesitate to reach out to me through my Linktree profile: linktr.ee/udyanojha
119. Pascal's Triangle II | O(N) | Java | Hindi
zhlédnutí 72Před 10 měsíci
In this video, we'll tackle question number 119. Pascal's Triangle II on Leetcode using Java. First, we will do O(n^2) and then optimise O(n). The explanation will be provided in Hindi for easy understanding. You can find the problem link in the First Comment. If you have any questions or need further assistance, please don't hesitate to reach out to me through my Linktree profile: linktr.ee/ud...
1269. Number of Ways to Stay in the Same Place After Some Steps | Hard | Memoization | Java | Hindi
zhlédnutí 32Před 10 měsíci
In this video, we'll tackle question number 1269. Number of Ways to Stay in the Same Place After Some Steps on Leetcode using Java. The explanation will be provided in Hindi for easy understanding. You can find the problem link here: leetcode.com/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps/ If you have any questions or need further assistance, please don't hesitate to rea...
746. Min Cost Climbing Stairs | EASY | Hindi | Java | DP RECURSION
zhlédnutí 85Před 10 měsíci
In this video, we'll tackle question number 746. Min Cost Climbing Stairs on Leetcode using Java. We'll demonstrate a solution with a time complexity of O(n). The explanation will be provided in Hindi for easy understanding. You can find the problem link here: leetcode.com/problems/min-cost-climbing-stairs/ If you have any questions or need further assistance, please don't hesitate to reach out...
1095. Find in Mountain Array | HARD | Hindi | Java Binary Search
zhlédnutí 144Před 10 měsíci
In this video, we'll tackle question number 1095. Find in Mountain Array on Leetcode using Java. We'll demonstrate a solution with a time complexity of O(log n). The explanation will be provided in Hindi for easy understanding. You can find the problem link here: leetcode.com/problems/find-in-mountain-array/ If you have any questions or need further assistance, please don't hesitate to reach ou...
2251. Number of Flowers in Full Bloom | HARD | Hindi | Java Binary Search
zhlédnutí 27Před 10 měsíci
In this video, we'll tackle question number 2251. Number of Flowers in Full Bloom on Leetcode using Java. We'll demonstrate a solution with a time complexity of O(n log n). The explanation will be provided in Hindi for easy understanding. You can find the problem link here: leetcode.com/problems/number-of-flowers-in-full-bloom/ If you have any questions or need further assistance, please don't ...
34 Find First and Last Position of Element in Sorted Array | MEDIUM | Binary Search
zhlédnutí 47Před 10 měsíci
In this video, we'll tackle question number 34. Find First and Last Position of Element in Sorted Array on Leetcode using Java. We'll demonstrate an efficient solution with a time complexity of O(log n) and a space complexity of O(1). The explanation will be provided in Hindi for easy understanding. You can find the problem link here: leetcode.com/problems/find-first-and-last-position-of-elemen...
1962. Remove Stones to Minimize the Total | Java Hindi | Priority Queue | LeetCode daily
zhlédnutí 94Před rokem
Hey folks! In this video, we discussed 1962 Remove Stones to Minimize the Total using Priority Queue Hindi using Java Language. 1962. Remove Stones to Minimize the Total Problem link: leetcode.com/problems/remove-stones-to-minimize-the-total/ If you have any queries reach out to me at linktr.ee/udyanojha
2389 Longest Subsequence With Limited Sum | LeetCode JAVA HINDI | TreeMap Prefix Sum |
zhlédnutí 159Před rokem
Hey folks! In this video, we discussed Longest Subsequence With Limited Sum using Prefix Sum and Tree Map in Hindi using Java Language. 2389. Longest Subsequence With Limited Sum Problem link: leetcode.com/problems/longest-subsequence-with-limited-sum/ If you have any queries reach out to me at linktr.ee/udyanojha
Leetcode || 739. Daily Temperatures || Hindi Java || O(N) MONOTONIC STACK 📚
zhlédnutí 382Před rokem
Hi folks! Here we are solving Daily Temperature with the help of a monotonic stack data structure in java language. If you have any doubts do reach out. 🐥Twitter: UdyanOjha 💻 Linkedin: www.linkedin.com/in/udyanojha/ 🤳 Instagram: udyanojha Problem link: leetcode.com/problems/daily-temperatures/ If you have any queries reach out to me at linktr.ee/udyanojha
150 Evaluate Reverse Polish Notation | JAVA Leetcode Daily December | Hindi
zhlédnutí 601Před rokem
Hi folks! Here we are solving Evaluate Reverse Polish Notation with the help of stack data structure in java language. If you have any doubt do reach out. Problem link : leetcode.com/problems/decode-ways/ If you have any query reach out to me at linktr.ee/udyanojha
872 Leaf Similar Trees using STACK
zhlédnutí 101Před rokem
Hi folks! Here we are solving Leaf Similar Trees in Java. Easy explanation in Hindi. Problem link: leetcode.com/problems/leaf-similar-trees/ If you have any queries reach out to me at linktr.ee/udyanojha
446. Arithmetic Slices II - Subsequence | HARD | Leetcode daily | JAVA | Hindi
zhlédnutí 270Před rokem
446. Arithmetic Slices II - Subsequence | HARD | Leetcode daily | JAVA | Hindi
1235. Maximum Profit in Job Scheduling | HARD | JAVA | Hindi
zhlédnutí 579Před rokem
1235. Maximum Profit in Job Scheduling | HARD | JAVA | Hindi
766. Toeplitz Matrix | Leetcode Hindi | Java
zhlédnutí 1,6KPřed rokem
766. Toeplitz Matrix | Leetcode Hindi | Java
Increasing Triplet Subsequence || Leetcode JAVA || O(N)
zhlédnutí 1KPřed rokem
Increasing Triplet Subsequence || Leetcode JAVA || O(N)
JAVA | 981. Time Based Key-Value Store | HINDI | LeetCode Daily
zhlédnutí 917Před rokem
JAVA | 981. Time Based Key-Value Store | HINDI | LeetCode Daily
1578 Minimum Time to Make Rope Colorful |💯Runtime Tip | JAVA | HINDI
zhlédnutí 276Před rokem
1578 Minimum Time to Make Rope Colorful |💯Runtime Tip | JAVA | HINDI
1155 Number of Dice Rolls With Target Sum | Recursion | Memoization | Tabulation DP | JAVA | HINDI
zhlédnutí 239Před rokem
1155 Number of Dice Rolls With Target Sum | Recursion | Memoization | Tabulation DP | JAVA | HINDI
JAVA | 91 Decode Ways | HINDI | LeetCode Daily
zhlédnutí 177Před rokem
JAVA | 91 Decode Ways | HINDI | LeetCode Daily
622 Design Circular Queue | Leetcode | Java | Hindi Using Array
zhlédnutí 867Před rokem
622 Design Circular Queue | Leetcode | Java | Hindi Using Array
1680 Concatenation of Consecutive Binary Numbers O(N) JAVA | HINDI | BIT MANIPULATION
zhlédnutí 239Před rokem
1680 Concatenation of Consecutive Binary Numbers O(N) JAVA | HINDI | BIT MANIPULATION
JAVA | 985 Sum of Even Numbers After Queries | HINDI | LeetCode Daily
zhlédnutí 443Před rokem
JAVA | 985 Sum of Even Numbers After Queries | HINDI | LeetCode Daily
609 Find Duplicate File in System | Hindi | Leetcode | Easy Explain
zhlédnutí 158Před rokem
609 Find Duplicate File in System | Hindi | Leetcode | Easy Explain
Hindi 1770 Maximum Score from Performing Multiplication Operations Leetcode HIndi
zhlédnutí 199Před rokem
Hindi 1770 Maximum Score from Performing Multiplication Operations Leetcode HIndi
Thik Hai.....
Thik Hai 👍
why we need to define next() and hasNext() as we are not using it here?? Is it required ??
The aim of this question is to design an Iterator, and it is defined in question to have next() and hasNext() implemented.
Dammmmmmmmmmm❤❤❤❤❤
Lessgoo 🔥
Appreciate the way of explaining 👏 👌
Most Welcome 😊
Very very well explanation
code in c++ class Solution { public: int bagOfTokensScore(vector<int>& tokens, int power) { sort(tokens.begin(),tokens.end()); int s=0,e=tokens.size()-1; int maxi=0; int curr=0; while(s<=e){ if(power>=tokens[s]){ curr+=1; … } maxi=max(maxi,curr); } return maxi; } };
btw i liked your video and its truely better then others explanation it was just like my big brother explaining me things
This means a lot to me. Connect on LinkedIn I’m glad to help.
sir tell me one thing the second condition was when the score is atleast greater then 1 then why are you taking max >0?
Believe me you are explainig very good keep it up..
Thank you, I will
Bhai, mai ekdum yahi so raha tha par aapne kitni asaani se bta diya. Well done 👍
Awesome h ye toh Aman bhai… lessgo 🔥
great explanation brother
Glad you liked it 😊
your explanation is really good . keep it up. please upload more videos if you can!
Try this test case : 2,1,5,0,6,7 The compiler accept this test case but if we dry run this test case by our own the rule of i<j<k is not satisfied here
"Promo sm" 😭
Bhai why did you stop making these videos?
Bhai banaunga phirse. I miss these videos.
You explained this the best way on entire CZcams ❤Now I m really looking forward to get solutions of entire leetcode from you 😆
I'm happy to help! Zaroor. Will solve many more questions together. New vid coming soon.
Let's Connect: linktr.ee/udyanojha
leetcode.com/problems/k-th-symbol-in-grammar/
Can you tell Space Complexity here?
class Solution { public boolean validateBinaryTreeNodes(int n, int[] leftChild, int[] rightChild) { HashMap<Integer, ArrayList<Integer>> parentChild = new HashMap<>(); HashMap<Integer, Integer> childParent = new HashMap<>(); for(int node = 0; node< n; node++) { int left = leftChild[node]; if(left != -1) { parentChild.putIfAbsent(node, new ArrayList<>()); parentChild.get(node).add(left); if(childParent.containsKey(left)){ return false; } else { childParent.put(left, node); } } int right = rightChild[node]; if(right != -1) { parentChild.putIfAbsent(node, new ArrayList<>()); parentChild.get(node).add(right); if(childParent.containsKey(right)){ return false; } else { childParent.put(right, node); } } } // Root? Multiple Hai ya nhi h // int root = -1; Integer root = null; for(int node = 0; node< n; node++) { if(!childParent.containsKey(node)) { if(root == null) { root = node; } else { return false; } } } if(root == null) { return false; } HashSet<Integer> visited = new HashSet<>(); Queue<Integer> que = new LinkedList<>(); que.add(root); while(!que.isEmpty()) { int node = que.remove(); visited.add(node); if(parentChild.containsKey(node)) { for(int child : parentChild.get(node)) { que.add(child); } } } return visited.size() == n; } }
Awesome explanation
Thank you ✨
class Solution { Integer[][] dp = new Integer[501][501]; public int numWays(int steps, int arrLen) { return helper(0, steps, arrLen); } private int helper(int i, int k, int len) { if(dp[i][k] != null) return dp[i][k]; if(i == 0 && k == 0) return 1; if(k==0) return 0; int left = (i > 0) ? helper(i-1, k-1, len) : 0; int stay = helper(i, k-1, len); int right = (i<len-1) ? helper(i+1, k-1, len) : 0; int total = ((left + stay) % (int)(1e9+7) + right) % (int)(1e9+7); return dp[i][k] = total; } }
Thanks for being here Coding JoySoul!
Bhaiya, aap ab lectures nhin banaoge kya?
Bana rha hu. Kal Delhi me nhi tha.
Bhaiya aapne video hi nhin daali Aaj, Main apne friends ko aapka channel recommend karta hun
Sorry kal emergency me jaana pada kahin! WIll upload aajse. Your supports matters a lot. Thanks
Bhaiya, Congratulations for 700 subscribers
Thank you so much. ♥️
Means a lot.
I felt that in this video, explanation was not beginner friendly
Yes I understand. Will record and post again.
Thanks for letting me know.
Tabulation: class Solution { public int minCostClimbingStairs(int[] cost) { int[] dp = new int[cost.length]; int n = cost.length-1; dp[0] = cost[0]; dp[1] = cost[1]; for(int i = 2; i < cost.length; i++) { dp[i] = cost[i] + Math.min(dp[i-1], dp[i-2]); } return Math.min(dp[n-1], dp[n]); } }
JAVA Memoization: class Solution { public int minCostClimbingStairs(int[] cost) { int[] dp = new int[cost.length]; Arrays.fill(dp, -1); return Math.min(helper(cost, 0, dp), helper(cost, 1, dp)); } private int helper(int[] cost, int idx, int[] dp) { if(idx>= cost.length) return 0; if(dp[idx]!= -1) return dp[idx]; return dp[idx] = cost[idx] + Math.min(helper(cost, idx+1, dp), helper(cost, idx+2, dp)); } }
Just a request. Please make all the Leetcode Solution videos of graph topic. Itna awesome padha rahe ho aap
Sure. I'll revise and revisit Graph again. Thoda time lagega. I'll start.
Glad to know that you are back.... frequent viewer of your channel. One thing is for sure... Your explanation is good.
Means a lot. Will share my updates too. Would love to connect. ✨
class Solution { public int findInMountainArray(int target, MountainArray mountainArr) { // Find Peak of Mountain int peakIdx = findPeak(mountainArr); // Now BS in left_ASC and right_DSC range int res = -1; // // EDGE CASE if(target > mountainArr.get(peakIdx)) return -1; res = BS_ASC(target, mountainArr, 0, peakIdx); if(res != -1) return res; return BS_DSC(target, mountainArr, peakIdx, mountainArr.length()-1); } private int BS_ASC(int target, MountainArray arr, int st, int ed) { while(ed>=st) { int mid = st + (ed-st)/2; if(arr.get(mid) == target) { return mid; } else if(arr.get(mid) > target) { ed = mid - 1; } else { st = mid + 1; } } return -1; } private int BS_DSC(int target, MountainArray arr, int st, int ed) { while(ed>=st) { int mid = st + (ed-st)/2; if(arr.get(mid) == target) { return mid; } else if(arr.get(mid) > target) { st = mid + 1; } else { ed = mid - 1; } } return -1; } private int findPeak(MountainArray arr) { int st = 0; int ed = arr.length() - 1; while(ed>=st) { int mid = st + (ed-st)/2; if(mid == 0) return 1; if(arr.get(mid-1) < arr.get(mid) && arr.get(mid) > arr.get(mid+1)) { return mid; } else if(arr.get(mid-1) < arr.get(mid) && arr.get(mid) < arr.get(mid+1)) { st = mid+1; } else { ed = mid-1; } } return -1; } }
class Solution { public int[] fullBloomFlowers(int[][] flowers, int[] people) { // Clone arr // Sort Flowers in St ASC // Sort Flowers in Ed ASC // O(n + nlogn + nlogn) // Do Search in st Just <= peoplei AS stIdx // Do Search in ed Just > peoplei // O(n + nlogn + nlogn + logn + logn) // In Res arr push 1 + stIdx - edIdx // it means number of flowers that bloom before = to people time - number of flowers that deBloom before people time int[] res = new int[people.length]; int[][] stFlowers = flowers.clone(); Arrays.sort(stFlowers, (a, b) -> a[0]>b[0] ? 1 : -1); int[][] edFlowers = flowers.clone(); Arrays.sort(edFlowers, (a, b) -> a[1]>b[1] ? 1 : -1); // for(int[] arr : stFlowers) System.out.println(arr[0] +" "+ arr[1]); // for(int[] arr : edFlowers) System.out.println(arr[0] +" "+ arr[1]); for(int i = 0; i<people.length; i++) { res[i] = 1 + stBS(stFlowers, people[i]) - edBS(edFlowers, people[i]); } // O(n + nlogn + nlogn + logn + logn + n) return res; } private int stBS(int[][] flowers, int x) { int stIdx =-1; int st = 0; int ed = flowers.length - 1; while(ed>=st) { int mid = st + (ed-st)/2; if(flowers[mid][0] <= x) { stIdx = mid; st = mid+1; } else { ed = mid-1; } } return stIdx; } private int edBS(int[][] flowers, int x) { int edIdx = -1; int st = 0; int ed = flowers.length - 1; while(ed>=st) { int mid = st + (ed-st)/2; if(flowers[mid][1] < x) { edIdx = mid; st = mid+1; } else { ed = mid-1; } } return edIdx+1; } }
Good work bhai 👍
Thanks bhai ♥️
Java Soln: class Solution { public int[] searchRange(int[] nums, int target) { int leftIdx = findLeft(nums, target); int rightIdx = findRight(nums, target); return new int[] {leftIdx, rightIdx}; } private int findLeft(int[] nums, int target) { int res = -1; int st = 0; int ed = nums.length-1; while(ed>=st) { int mid = st + (ed-st)/2; if(nums[mid]==target) { res = mid; ed = mid-1; } else if(nums[mid] > target) { ed = mid-1; } else { st = mid+1; } } return res; } private int findRight(int[] nums, int target) { int res = -1; int st = 0; int ed = nums.length-1; while(ed>=st) { int mid = st + (ed-st)/2; if(nums[mid]==target) { res = mid; st = mid+1; } else if(nums[mid] > target) { ed = mid-1; } else { st = mid+1; } } return res; } }
Please continue making the Leetcode solution videos again
Why have you stopped making Leetcode solution videos. Please start making videos again, you are doing a good work. Please, please ,please
Working on Graph, but first have to revise other required topics.
@@udyanishere thanks Bhaiya 💯
Your approach is good but initially got below approach in my mind and implemented but after watching your solution it good class Solution { public static boolean checkToeplitz(int i, int j,int[][] matrix){ while(i < matrix.length && j < matrix[0].length){ if(matrix[i][j] != matrix[i-1][j-1]){ return false; } i++; j++; } return true; } public boolean isToeplitzMatrix(int[][] matrix) { int n = matrix.length; int m = matrix[0].length; //My approach is first check the first row whether it is diagonally perfect then check first column whether it is diagonally perfect. //row checking int currentRow = 0; for(int i=0;i<matrix[0].length;i++){ boolean res = checkToeplitz(currentRow+1,i+1,matrix); if(!res){ return false; } } //column checking //for this iteration i am considering as row int currentCol = 0; for(int j=1;j<matrix.length;j++){ boolean res = checkToeplitz(j+1,currentCol+1,matrix); if(!res){ return false; } } return true; } }
Great Explanation
Glad you liked it
Very nice explanation ! Thank you so muchhhhh <3
You are welcome! <3
bhadiya video thi, hai, nhi rahegi
Bhai mujhe alog basic se learn krni hai.
Excellent bro
Wow what an explanation bro! 🤩🤩🤩 God bless you 🥰🥰🥰
I just found that It's similar to partion sort (card game)
Wow!!!
this code is not working bro 😢😢
Sad. Let me look into it
add the additional condition in "if" block as i>=0 and j>=0
Thanks buddy for making such a nice solution video.
Most welcome 🫂
class Solution { public int[] answerQueries(int[] nums, int[] queries) { int[] prefixSum = new int[nums.length]; Arrays.sort(nums); TreeMap<Integer, Integer> map = new TreeMap<>(); prefixSum[0] = nums[0]; map.put(prefixSum[0], 1); for(int i = 1; i<nums.length; i++) { prefixSum[i] = prefixSum[i-1] + nums[i]; map.put(prefixSum[i], i+1); } int[] ans = new int[queries.length]; int k = 0; for(int query : queries) { Map.Entry<Integer, Integer> entry = map.floorEntry(query); if(entry != null) { ans[k] = entry.getValue(); } k++; } return ans; } }
Great explanation bro👌🏻
Glad you liked it