- 522
- 1 210 216
shashCode
India
Приєднався 17 тра 2011
Hi I am Shashwat Tiwari, software engineer at Samsung Research. I enjoy solving problems using coding and other computer science stuff. This channel is for sharing knowledge on programming, computer science fundamentals, data structures and algorithms, and a lot more with touch of motivational talks. You can get free courses, learn how to code, how to start programming, how to prepare for Interviews and everything in between.
Learn to develop in hindi
Learn to code in hindi
Btw Hindi is my language , programming language could be java, python, c++, javascipt, go lang.
Feel free to dm me whenever you want: linktr.ee/shashwat_tiwari_st
Learn to develop in hindi
Learn to code in hindi
Btw Hindi is my language , programming language could be java, python, c++, javascipt, go lang.
Feel free to dm me whenever you want: linktr.ee/shashwat_tiwari_st
1905. Count Sub Islands | graphs | Leetcode Daily Challenge | DSA | Hindi
Number of Islands:
ua-cam.com/video/mwsuv-S1biw/v-deo.htmlsi=G1YDo-wyHLOZloie
Problem Name:
1905. Count Sub Islands
Problem Statement:
You are given two m x n binary matrices grid1 and grid2 containing only 0's (representing water) and 1's (representing land). An island is a group of 1's connected 4-directionally (horizontal or vertical). Any cells outside of the grid are considered water cells.
An island in grid2 is considered a sub-island if there is an island in grid1 that contains all the cells that make up this island in grid2.
Return the number of islands in grid2 that are considered sub-islands.
Problem Link:
leetcode.com/problems/count-sub-islands/description/?envType=daily-question&envId=2024-08-28
Solution Link:
github.com/Tiwarishashwat/InterviewCodes/blob/main/CountSubIsIland.java
Graph Playlist:
ua-cam.com/play/PLQ7ZAf76c0ZOGuMjg3qwNgILb_dKWTxyQ.html
Java Plus DSA Placement Course Playlist:
ua-cam.com/play/PLQ7ZAf76c0ZPVdhV1bAjFv0bQc1xHURzE.html
Java Plus DSA Sheet:
docs.google.com/spreadsheets/d/119u25NO-4ZJ9zwfUKs5eGNo0exCVq3gZEFWvkCDiMqI/edit?usp=sharing
Notes:
github.com/Tiwarishashwat/Java-Plus-DSA-Placement-Course
Telegram Link:
shashwattiwari.page.link/telegramShashwat
Ultimate Recursion Series Playlist:
ua-cam.com/play/PLQ7ZAf76c0ZMzC9OHPbo-dUgx6oU3T0jK.html
Instagram Handle: (@shashwat_tiwari_st)
shashwattiwari.page.link/shashwatInsta
Samsung Interview Experience:
ua-cam.com/video/GrvlpBzphSU/v-deo.html
Company Tags:
Facebook | Amazon | Microsoft | Netflix | Google | LinkedIn | Pega Systems | VMware | Adobe | Samsung
Timestamp:
0:00 - Introduction
#ShashwatTiwari #coding #problemsolving
ua-cam.com/video/mwsuv-S1biw/v-deo.htmlsi=G1YDo-wyHLOZloie
Problem Name:
1905. Count Sub Islands
Problem Statement:
You are given two m x n binary matrices grid1 and grid2 containing only 0's (representing water) and 1's (representing land). An island is a group of 1's connected 4-directionally (horizontal or vertical). Any cells outside of the grid are considered water cells.
An island in grid2 is considered a sub-island if there is an island in grid1 that contains all the cells that make up this island in grid2.
Return the number of islands in grid2 that are considered sub-islands.
Problem Link:
leetcode.com/problems/count-sub-islands/description/?envType=daily-question&envId=2024-08-28
Solution Link:
github.com/Tiwarishashwat/InterviewCodes/blob/main/CountSubIsIland.java
Graph Playlist:
ua-cam.com/play/PLQ7ZAf76c0ZOGuMjg3qwNgILb_dKWTxyQ.html
Java Plus DSA Placement Course Playlist:
ua-cam.com/play/PLQ7ZAf76c0ZPVdhV1bAjFv0bQc1xHURzE.html
Java Plus DSA Sheet:
docs.google.com/spreadsheets/d/119u25NO-4ZJ9zwfUKs5eGNo0exCVq3gZEFWvkCDiMqI/edit?usp=sharing
Notes:
github.com/Tiwarishashwat/Java-Plus-DSA-Placement-Course
Telegram Link:
shashwattiwari.page.link/telegramShashwat
Ultimate Recursion Series Playlist:
ua-cam.com/play/PLQ7ZAf76c0ZMzC9OHPbo-dUgx6oU3T0jK.html
Instagram Handle: (@shashwat_tiwari_st)
shashwattiwari.page.link/shashwatInsta
Samsung Interview Experience:
ua-cam.com/video/GrvlpBzphSU/v-deo.html
Company Tags:
Facebook | Amazon | Microsoft | Netflix | Google | LinkedIn | Pega Systems | VMware | Adobe | Samsung
Timestamp:
0:00 - Introduction
#ShashwatTiwari #coding #problemsolving
Переглядів: 140
Відео
1514. Path with Maximum Probability | graphs | Bellmanford | Leetcode Daily Challenge | DSA | Hindi
Переглядів 1,4 тис.2 години тому
Problem Name: 1514. Path with Maximum Probability Problem Statement: You are given an undirected weighted graph of n nodes (0-indexed), represented by an edge list where edges[i] = [a, b] is an undirected edge connecting the nodes a and b with a probability of success of traversing that edge succProb[i]. Given two nodes start and end, find the path with the maximum probability of success to go ...
590. N-ary Tree Postorder Traversal | trees | Leetcode Daily Challenge | DSA | Hindi
Переглядів 2,1 тис.4 години тому
Problem Name: 590. N-ary Tree Postorder Traversal Problem Statement: Given the root of an n-ary tree, return the postorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal. Each group of children is separated by the null value (See examples) Problem Link: leetcode.com/problems/n-ary-tree-postorder-traversal/description/?envType=daily-qu...
145. Binary Tree Postorder Traversal | trees | dfs | Leetcode Daily Challenge | DSA | Hindi
Переглядів 1,2 тис.7 годин тому
Iterative Postorder traversal: ua-cam.com/video/xEPe6aWlRd0/v-deo.htmlsi=zEBSlBGBvFqZI3tu Problem Name: 145. Binary Tree Postorder Traversal Problem Statement: Given the root of a binary tree, return the postorder traversal of its nodes' values. Problem Link: leetcode.com/problems/binary-tree-postorder-traversal/description/?envType=daily-question&envId=2024-08-25 Graph Playlist: ua-cam.com/pla...
564. Find the Closest Palindrome | maths | strings | Leetcode Daily Challenge | DSA | Hindi
Переглядів 2,9 тис.9 годин тому
Problem Name: 564. Find the Closest Palindrome Problem Statement: Given a string n representing an integer, return the closest integer (not including itself), which is a palindrome. If there is a tie, return the smaller one. The closest is defined as the absolute difference minimized between two integers. Problem Link: leetcode.com/problems/find-the-closest-palindrome/description/?envType=daily...
592. Fraction Addition and Subtraction | maths | strings | Leetcode Daily Challenge | DSA | Hindi
Переглядів 2,5 тис.12 годин тому
Problem Name: 592. Fraction Addition and Subtraction Problem Statement: Given a string expression representing an expression of fraction addition and subtraction, return the calculation result in string format. The final result should be an irreducible fraction. If your final result is an integer, change it to the format of a fraction that has a denominator 1. So in this case, 2 should be conve...
476. Number Complement | Bit Manipulation | Leetcode Daily Challenge | DSA | Hindi
Переглядів 1,7 тис.14 годин тому
Problem Name: 476. Number Complement Problem Statement: The complement of an integer is the integer you get when you flip all the 0's to 1's and all the 1's to 0's in its binary representation. For example, The integer 5 is "101" in binary and its complement is "010" which is the integer 2. Given an integer num, return its complement. Problem Link: leetcode.com/problems/number-complement/descri...
Lecture-13 | 1443. Minimum Time to Collect All Apples in a Tree | leetcode | DSA | Hindi
Переглядів 360День тому
Problem Name: 1443. Minimum Time to Collect All Apples in a Tree Problem Statement: Given an undirected tree consisting of n vertices numbered from 0 to n-1, which has some apples in their vertices. You spend 1 second to walk over one edge of the tree. Return the minimum time in seconds you have to spend to collect all apples in the tree, starting at vertex 0 and coming back to this vertex. The...
Lecture-14 | 947. Most Stones Removed with Same Row or Column | Graphs | Leetcode | DSA | Hindi
Переглядів 13914 днів тому
Problem Name: 947. Most Stones Removed with Same Row or Column Problem Statement: On a 2D plane, we place n stones at some integer coordinate points. Each coordinate point may have at most one stone. A stone can be removed if it shares either the same row or the same column as another stone that has not been removed. Given an array stones of length n where stones[i] = [xi, yi] represents the lo...
Lecture-12 994. Rotting Oranges | BFS | Graphs| Leetcode | DSA | Hindi
Переглядів 14014 днів тому
Problem Name: 994. Rotting Oranges Problem Statement: You are given an m x n grid where each cell can have one of three values: 0 representing an empty cell, 1 representing a fresh orange, or 2 representing a rotten orange. Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten. Return the minimum number of minutes that must elapse until no cell has a ...
Lecture-11 | 1311. Get Watched Videos by Your Friends | Graphs | Leetcode | DSA | Hindi
Переглядів 14914 днів тому
Problem Name: 1311. Get Watched Videos by Your Friends Problem Statement: There are n people, each person has a unique id between 0 and n-1. Given the arrays watchedVideos and friends, where watchedVideos[i] and friends[i] contain the list of watched videos and the list of friends respectively for the person with id = i. Level 1 of videos are all watched videos by your friends, level 2 of video...
Lecture - 15 | 721. Accounts Merge | graphs | Leetcode Daily Challenge | DSA | Hindi
Переглядів 17514 днів тому
Problem Name: 721. Accounts Merge Problem Statement: Given a list of accounts where each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails of the account. Now, we would like to merge these accounts. Two accounts definitely belong to the same person if there is some common email to both accounts...
703. Kth Largest Element in a Stream | Leetcode Daily Challenge | DSA | Hindi
Переглядів 3,3 тис.14 днів тому
Problem Name: 703. Kth Largest Element in a Stream Problem Statement: Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. Implement KthLargest class: KthLargest(int k, int[] nums) Initializes the object with the integer k and the stream of integers nums. int add(int val) Appends the integer val to...
959. Regions Cut By Slashes | graphs | Leetcode Daily Challenge | DSA | Hindi
Переглядів 2,8 тис.14 днів тому
Problem Name: 959. Regions Cut By Slashes Problem Statement: An n x n grid is composed of 1 x 1 squares where each 1 x 1 square consists of a '/', '\', or blank space ' '. These characters divide the square into contiguous regions. Given the grid grid represented as a string array, return the number of regions. Note that backslash characters are escaped, so a '\' is represented as '\\'. Problem...
840. Magic Squares In Grid | Leetcode Daily Challenge | DSA | Hindi
Переглядів 4,8 тис.14 днів тому
840. Magic Squares In Grid | Leetcode Daily Challenge | DSA | Hindi
885. Spiral Matrix III | matrix | Leetcode Daily Challenge | DSA | Hindi
Переглядів 4,3 тис.14 днів тому
885. Spiral Matrix III | matrix | Leetcode Daily Challenge | DSA | Hindi
273. Integer to English Words | Leetcode Daily Challenge | DSA | Hindi
Переглядів 4,9 тис.21 день тому
273. Integer to English Words | Leetcode Daily Challenge | DSA | Hindi
3016. Minimum Number of Pushes to Type Word II | Leetcode Daily Challenge | DSA | Hindi
Переглядів 3,4 тис.21 день тому
3016. Minimum Number of Pushes to Type Word II | Leetcode Daily Challenge | DSA | Hindi
2053. Kth Distinct String in an Array | string | Leetcode Daily Challenge | DSA | Hindi
Переглядів 2,2 тис.21 день тому
2053. Kth Distinct String in an Array | string | Leetcode Daily Challenge | DSA | Hindi
Range Sum of Sorted Subarray Sums | Priority Queue | Leetcode Daily Challenge | DSA | Hindi
Переглядів 2,2 тис.21 день тому
Range Sum of Sorted Subarray Sums | Priority Queue | Leetcode Daily Challenge | DSA | Hindi
1460. Make Two Arrays Equal by Reversing Subarrays | Leetcode Daily Challenge | DSA | Hindi
Переглядів 1,4 тис.21 день тому
1460. Make Two Arrays Equal by Reversing Subarrays | Leetcode Daily Challenge | DSA | Hindi
2134. Minimum Swaps to Group All 1's Together II | sliding window | Leetcode Daily Challenge | DSA
Переглядів 3,2 тис.21 день тому
2134. Minimum Swaps to Group All 1's Together II | sliding window | Leetcode Daily Challenge | DSA
2678. Number of Senior Citizens | String Manipulation | Leetcode Daily Challenge | DSA | Hindi
Переглядів 1,7 тис.21 день тому
2678. Number of Senior Citizens | String Manipulation | Leetcode Daily Challenge | DSA | Hindi
1105. Filling Bookcase Shelves | DP | Leetcode Daily Challenge | DSA | Hindi
Переглядів 3 тис.28 днів тому
1105. Filling Bookcase Shelves | DP | Leetcode Daily Challenge | DSA | Hindi
1653. Minimum Deletions to Make String Balanced | pre-computation | Leetcode Daily | DSA | Hindi
Переглядів 1,5 тис.28 днів тому
1653. Minimum Deletions to Make String Balanced | pre-computation | Leetcode Daily | DSA | Hindi
1395. Count Number of Teams | greedy | maths | Leetcode Daily Challenge | DSA | Hindi
Переглядів 2,4 тис.28 днів тому
1395. Count Number of Teams | greedy | maths | Leetcode Daily Challenge | DSA | Hindi
2045. Second Minimum Time to Reach Destination | graph | Leetcode Daily Challenge | DSA | Hindi
Переглядів 1 тис.28 днів тому
2045. Second Minimum Time to Reach Destination | graph | Leetcode Daily Challenge | DSA | Hindi
2976. Minimum Cost to Convert String I | graph | Leetcode Daily Challenge | DSA | Hindi
Переглядів 723Місяць тому
2976. Minimum Cost to Convert String I | graph | Leetcode Daily Challenge | DSA | Hindi
1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance | Leetcode | DSA
Переглядів 569Місяць тому
1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance | Leetcode | DSA
Floyd Warshall Algorithm | Shortest Path in Graph | GFG | DSA | Hindi
Переглядів 334Місяць тому
Floyd Warshall Algorithm | Shortest Path in Graph | GFG | DSA | Hindi
when will the cycle detection in graph vdos be released?
osm explain
first again🤩🤩🤩
Like target for this video is 120, please do like. Aaj ka question ban gaya hoga na? koi aur approach use kri hai toh share kro!! 😄
In worst case ..why it does not give TLE because 2<=n<=1e4 and 0<=edges_length <=2*1e4??
what is that 'V" that you used to define the variable prob of type double, moreover it is not pre-defined please check
@@liki_raju ya I have corrected it in video before submission, it should be n, (total number of vertices)
bhaiya itna sab kara rahe to DP ka bhi thoda sochiye na please
amazing approach. so simple and easy to understand. I used the same approach in the first try but then tried to solve it using dijkstra when i saw the hints in the question. Anyways, Kuddos
👏
Using HashMap sol : -> ✅LeetCode:- class Solution { public String replaceWords(List<String> dictionary, String sentence) { HashSet<String> set = new HashSet<>(); for(String s : dictionary){ set.add(s); } String[]wordsArr = sentence.split(" "); StringBuilder sb = new StringBuilder(); for(String currWord : wordsArr){ String replaceWord = currWord; for(int i = 0;i<currWord.length();i++){ String prefix = currWord.substring(0, i+1); if(set.contains(prefix)){ replaceWord = prefix; break; } } sb.append(replaceWord).append(" "); } return sb.toString().trim(); } }
Can we have a separate detailed video for Bellman ford? This video feels rushed
Ya I have not explained bellmanford in this video, By tomorrow evening you will get bellmanford algo..
@@shashwat_tiwari_st You're the man, no other youtuber does this
you make us understand every problem very easily...
😄😄
like target for this video is 100, please do like if you have understood😃
Amazing content
Great , love from jadavpur uni
Sir iska Notes nhi h ?
please add c++ too.
Sir we want iteratively method by stack and deque . Plzzz
Sir when are you releasing DP Series. Eagarly waiting ! Can we expect it around mid of September
Sir your graph series is amazing one of the best creator but if you upload videos like a day in life of samsung developer then reach zyada rate se increase hogi I don't know right or wrong but this is my opinion
Thankyou 😄, idea acha hai,
easiest explaination thank you so much sirr
Happy Janmashtami😄
same to you sir
Can you have playlist of array coding of leetcode from beginners to pro ? Plz let me know
Like target is 100, Please do like if you have understood the explanation!
done
how space complexity is n-k ,could you please explain in detail ?
the above question is for brut force approach.
ok bhaiya watching iterative method also :")
c++ class Solution { public: //week 13 void postorderTraversalHelper(TreeNode* root, vector<int>& ans) { if(root == NULL) return; else { //L postorderTraversalHelper(root->left, ans); //R postorderTraversalHelper(root->right, ans); //N ans.push_back(root->val); } } vector<int> postorderTraversal(TreeNode* root) { //postorderTraversal -> LRN //we will solve this using recurssion vector<int> ans; //we will use a helper function postorderTraversalHelper(root, ans); return ans; } };
2 Homework In Java, a String is both a data type and a class. String as a Class: It belongs to java.lang.String and provides various methods to manipulate text. String as a Data Type: It represents a sequence of characters and is a reference data type in Java.
👏👏
Day 2 Lecture 4 Complated✅
Bhaiya mein morris traversal se kiya
Aur bhi badhiya h
ban gaya tha aaj, special thanks to your EPIC Tree Series😍
Please do like this video, Like target for this video is 120. Please do watch iterative approach as well!
awesome explanation bhaiya
awesome thanks
Great Explanation!
I try this question by mySelf pass : 37/217 then for which testcase it's failed i fixed that but the code gives me TLE. Please somebody help me to fixed my code. #Code_is_given_below--> ```class Solution { public String nearestPalindromic(String n) { int mindif = Integer.MAX_VALUE; int num = Integer.parseInt(n); if(num == 1){return "0";} if(num >= 2 && num <= 10){ return Integer.toString(num - 1) ; } int ans = 0; //this is for the nearest palindrom bellow given "n" ex - > 123 for (int i = 1; i < num; i++) { if (isPalindrom(i)) { int currDif = num - i; if (currDif < mindif) { mindif = currDif; ans = i; } // break; } } //for this type of test case give error - > "1213" output ->"1221" for(int i = num+1; ;i++){ if(isPalindrom(i)){ int currDif = i - num; if(currDif < mindif){ ans = i; // get the first palindrome given number and stop there. } break; } } return Integer.toString(ans); } public boolean isPalindrom(int n){ int org = n; int rev = 0; while(n>0){ int lastdig = n%10; rev = (rev*10) + lastdig; n = n/10; } return (org != rev) ? false : true; } }```
New to DSA concept your video is very helpful bhaiya❤
❤❤❤
Bhaiya mere dimag mein pehele aaya tha, ki given string ko number mein convert koro, uske band do variable create Kara, ek given num - 1 and dusre given num + 1, and create a function to check palindrome, and call for both numbers, if both are palindrome then return minimum else return that number which is palindrome among both I know that it is ghatia approach, can anyone thought about this also? Please say
Maine socha tha, but constraints dekh kr TLE hi laga toh try ni kra
Bahot hi hard tha per ye video dekh ke samj me aa gaya .
Glad it helped!
thankyou sir ,but please come up with examples that are not there in editorial... like 2002,11011....etc this will help us more .
Ok noted.
thanks G
Animal is a class and cat ,dog , lion is an Object 🙂
Subha 8 baje Baitha tha ye qs solve karne ke liye abhi solve hua khudse Almost 12 hr 😂 😂😢
Gajab dedication hai 👏 👌
NICE SUPER EXCELLENT MOTIVATED
shashwat Bhaia tum Aage badho Hum tumare sath Hai.....
public String nearestPalindromic(String n){ long num=Long.valueOf(n); long small=smallest(String.valueOf(num-1)); long large=largest(String.valueOf(num+1)); if(large-num<num-small) return String.valueOf(large); else return String.valueOf(small); } private long largest(String n){ char[]c=n.toCharArray (); int s=0,e=c.length-1; while(s<e){ while(c[s]!=c[e]){ incrementNum(c,end); } s++;e--; } return Long.parseLong(String.valueOf(c)); } private long smallest(String n){ char[]c=n.toCharArray(); int s=0,e=c.length-1; while(s<e){ while(c[s]!=c[e]){ decrementNum(c,end); if(c[0]=='0') return Long.parseLong(String.valueOf(c)); } s++;e--; } return Long.parseLong(String.valueOf(c)); } private void decrementNum(char[]c,int i){ while(c[i]=='0'){ c[i]='9'; i--; } c[i]--; } private void incrementNum(char[]c,int i){ while(c[i]=='9'){ c[i]='0'; i--; } c[i]++; } } 🎉❤
mene jab logic lagaya to run bhi hogya lekin test cases failed, par jab ye video dekha tab laga ye isliye HARD TAG tha😅😝
😂😂
TQ sir aapne bhut ache se samjhaya ❤
tagra question tha bhaiya, maza aa gya 😍😍
Log ro rhe hai 🤣 tmhe maza aa gya, waise strings manipulation toh mra bhi fav topic h
little correction, we are using an arraylist of size 5, so although space is as good as constant but still you can mention it.