- 512
- 37 040
Developer Coder
India
เข้าร่วมเมื่อ 3 ม.ค. 2021
🚀 Welcome to DEVELOPER CODER! 🖥️
Dive into the world of coding mastery with my channel dedicated to bringing you top-notch coding tutorials, development insights, and daily LeetCode challenges! 💻🌟
Explore the vast realm of Java and stay updated on the latest in the tech world with our engaging content. Whether you're a seasoned developer or just starting your coding journey, DEVELOPER CODER is your go-to source for learning, growing, and staying ahead in the dynamic field of programming. 🌐🔍
Join our community of passionate coders, sharpen your skills, and embark on a journey of continuous learning. Subscribe now and unlock the door to endless possibilities in the coding universe! 🚀🔐 #CodeWithDeveloperCoder #TechTutorials #javadevelopmenttools
Feel free to contact me at the following email: iamcoderdeveloper@gmail.com
Dive into the world of coding mastery with my channel dedicated to bringing you top-notch coding tutorials, development insights, and daily LeetCode challenges! 💻🌟
Explore the vast realm of Java and stay updated on the latest in the tech world with our engaging content. Whether you're a seasoned developer or just starting your coding journey, DEVELOPER CODER is your go-to source for learning, growing, and staying ahead in the dynamic field of programming. 🌐🔍
Join our community of passionate coders, sharpen your skills, and embark on a journey of continuous learning. Subscribe now and unlock the door to endless possibilities in the coding universe! 🚀🔐 #CodeWithDeveloperCoder #TechTutorials #javadevelopmenttools
Feel free to contact me at the following email: iamcoderdeveloper@gmail.com
Neighboring Bitwise XOR | LeetCode 2683 | Cumulative XOR | Java Code | Developer Coder
Welcome to another exciting video on the 'Developer Coder' channel! In this tutorial, we dive into the fascinating LeetCode problem Neighboring Bitwise XOR. Using the Cumulative XOR approach, we explore an efficient solution in Java to solve this challenging problem. Whether you're preparing for coding interviews or enhancing your problem-solving skills, this video has you covered!
💡 What You'll Learn:
Cumulative XOR concept in action.
Optimized Java implementation.
Coding tips for tackling similar XOR-based problems.
🎯 Don't forget to like, share, and subscribe for more insightful coding tutorials and interview preparation content.
#NeighboringBitwiseXOR #LeetCode2683 #CumulativeXOR #JavaProgramming #CodingChallenges #DeveloperCoder #BitManipulation #ProgrammingTips #LeetCodeSolutions #XORProblems #JavaCode #InterviewPreparation #CodingInterview #ProgrammingTutorial #JavaXOR #CodeEfficiently #LearnCoding #SoftwareDevelopment #JavaAlgorithms #LeetCodeJava #Google #Microsoft #Apple #Amazon #Facebook #IBM #Oracle #Cisco #Intel #Dell #HP #Adobe #Salesforce #SAP #NVIDIA #Tencent #Alibaba #Sony #Netflix #Baidu #Xiaomi #Qualcomm #VMware #Twitter #Fujitsu #Lenovo #Infosys #Capgemini #Accenture
Neighboring Bitwise XOR LeetCode solution
LeetCode 2683 Java code
Cumulative XOR Java implementation
Neighboring XOR problem LeetCode
XOR-based coding problems Java
Bitwise operations in LeetCode
How to solve Neighboring Bitwise XOR
LeetCode XOR challenges explained
Cumulative XOR example problems
LeetCode 2683 Neighboring Bitwise XOR
Java coding tutorial for XOR problems
LeetCode XOR optimization techniques
Bit manipulation in Java
Neighboring XOR LeetCode example
Understanding XOR in Java coding
Coding challenges on XOR
Efficient XOR solutions LeetCode
Neighboring XOR coding interview problem
Cumulative XOR practical examples
Java XOR coding tutorial
LeetCode 2683 explained
Neighboring Bitwise XOR Java solution
How to use XOR in coding problems
Developer Coder XOR tutorials
LeetCode 2683 best solution
Cumulative XOR problem-solving LeetCode
Neighboring XOR optimization Java
XOR problem-solving strategies
LeetCode XOR coding solutions
Neighboring Bitwise XOR explained
Bitwise XOR example problems Java
Efficient coding techniques XOR
XOR-based interview question Java
Neighboring XOR in competitive programming
Cumulative XOR Java coding guide
LeetCode XOR algorithm explained
Developer Coder LeetCode tutorials
Neighboring Bitwise XOR algorithm
Java problem-solving XOR problems
Cumulative XOR bitwise logic
How to approach XOR in Java
LeetCode XOR interview tips
Neighboring Bitwise XOR explained Java
LeetCode XOR advanced tutorial
Bit manipulation techniques XOR
Cumulative XOR challenges LeetCode
Java XOR implementation LeetCode
Neighboring XOR coding walkthrough
Java coding tutorials Developer Coder
LeetCode 2683 coding explanation
Neighboring XOR best practices coding
Coding XOR problems efficiently
How to master XOR coding Java
LeetCode XOR approach tutorial
Developer Coder Java XOR tutorial
Java XOR for coding interviews
Neighboring Bitwise XOR video tutorial
How to solve XOR LeetCode problems
Efficient XOR Java programming
Cumulative XOR explained Developer Coder
XOR coding solutions Developer Coder
XOR tips for Java programming
Java XOR problem walkthrough
Cumulative XOR best approach LeetCode
Neighboring XOR implementation Java
Bit manipulation for beginners Java
LeetCode XOR implementation guide
XOR concept explained for interviews
Developer Coder LeetCode XOR guide
Java programming XOR solutions
Neighboring XOR logic explained
Cumulative XOR tricks and tips
Coding XOR efficiently in Java
XOR-based LeetCode Java problems
LeetCode XOR 2683 walkthrough
How to solve XOR efficiently Java
Coding tips for XOR problems Java
Neighboring XOR problem-solving Java
LeetCode XOR Java programming guide
Cumulative XOR solutions tutorial
Efficient programming XOR problems Java
Neighboring XOR explained step by step
XOR coding examples in Java
💡 What You'll Learn:
Cumulative XOR concept in action.
Optimized Java implementation.
Coding tips for tackling similar XOR-based problems.
🎯 Don't forget to like, share, and subscribe for more insightful coding tutorials and interview preparation content.
#NeighboringBitwiseXOR #LeetCode2683 #CumulativeXOR #JavaProgramming #CodingChallenges #DeveloperCoder #BitManipulation #ProgrammingTips #LeetCodeSolutions #XORProblems #JavaCode #InterviewPreparation #CodingInterview #ProgrammingTutorial #JavaXOR #CodeEfficiently #LearnCoding #SoftwareDevelopment #JavaAlgorithms #LeetCodeJava #Google #Microsoft #Apple #Amazon #Facebook #IBM #Oracle #Cisco #Intel #Dell #HP #Adobe #Salesforce #SAP #NVIDIA #Tencent #Alibaba #Sony #Netflix #Baidu #Xiaomi #Qualcomm #VMware #Twitter #Fujitsu #Lenovo #Infosys #Capgemini #Accenture
Neighboring Bitwise XOR LeetCode solution
LeetCode 2683 Java code
Cumulative XOR Java implementation
Neighboring XOR problem LeetCode
XOR-based coding problems Java
Bitwise operations in LeetCode
How to solve Neighboring Bitwise XOR
LeetCode XOR challenges explained
Cumulative XOR example problems
LeetCode 2683 Neighboring Bitwise XOR
Java coding tutorial for XOR problems
LeetCode XOR optimization techniques
Bit manipulation in Java
Neighboring XOR LeetCode example
Understanding XOR in Java coding
Coding challenges on XOR
Efficient XOR solutions LeetCode
Neighboring XOR coding interview problem
Cumulative XOR practical examples
Java XOR coding tutorial
LeetCode 2683 explained
Neighboring Bitwise XOR Java solution
How to use XOR in coding problems
Developer Coder XOR tutorials
LeetCode 2683 best solution
Cumulative XOR problem-solving LeetCode
Neighboring XOR optimization Java
XOR problem-solving strategies
LeetCode XOR coding solutions
Neighboring Bitwise XOR explained
Bitwise XOR example problems Java
Efficient coding techniques XOR
XOR-based interview question Java
Neighboring XOR in competitive programming
Cumulative XOR Java coding guide
LeetCode XOR algorithm explained
Developer Coder LeetCode tutorials
Neighboring Bitwise XOR algorithm
Java problem-solving XOR problems
Cumulative XOR bitwise logic
How to approach XOR in Java
LeetCode XOR interview tips
Neighboring Bitwise XOR explained Java
LeetCode XOR advanced tutorial
Bit manipulation techniques XOR
Cumulative XOR challenges LeetCode
Java XOR implementation LeetCode
Neighboring XOR coding walkthrough
Java coding tutorials Developer Coder
LeetCode 2683 coding explanation
Neighboring XOR best practices coding
Coding XOR problems efficiently
How to master XOR coding Java
LeetCode XOR approach tutorial
Developer Coder Java XOR tutorial
Java XOR for coding interviews
Neighboring Bitwise XOR video tutorial
How to solve XOR LeetCode problems
Efficient XOR Java programming
Cumulative XOR explained Developer Coder
XOR coding solutions Developer Coder
XOR tips for Java programming
Java XOR problem walkthrough
Cumulative XOR best approach LeetCode
Neighboring XOR implementation Java
Bit manipulation for beginners Java
LeetCode XOR implementation guide
XOR concept explained for interviews
Developer Coder LeetCode XOR guide
Java programming XOR solutions
Neighboring XOR logic explained
Cumulative XOR tricks and tips
Coding XOR efficiently in Java
XOR-based LeetCode Java problems
LeetCode XOR 2683 walkthrough
How to solve XOR efficiently Java
Coding tips for XOR problems Java
Neighboring XOR problem-solving Java
LeetCode XOR Java programming guide
Cumulative XOR solutions tutorial
Efficient programming XOR problems Java
Neighboring XOR explained step by step
XOR coding examples in Java
มุมมอง: 6
วีดีโอ
Bitwise XOR of All Pairings | LeetCode 2425 | 2 Approaches | Java Code | Developer Coder
มุมมอง 152 ชั่วโมงที่ผ่านมา
🎥 Welcome to Developer Coder, your go-to channel for mastering LeetCode problems! In this video, we tackle the fascinating problem "Bitwise XOR of All Pairings" (LeetCode 2425) using two approaches: 1️⃣ HashMap for better clarity. 2️⃣ Space-optimized bit manipulation for enhanced performance. 🔍 Dive deep into the thought process, Java implementation, and space optimization techniques to solve t...
Minimize XOR | LeetCode 2429 | Java Code | Developer Coder
มุมมอง 384 ชั่วโมงที่ผ่านมา
Welcome to Developer Coder! 🚀 In this video, we'll tackle the LeetCode problem Minimize XOR (Problem 2429) using Java. This video is perfect for anyone looking to improve their problem-solving skills, master bitwise operations, and enhance their understanding of Java programming. Don’t forget to like, share, and subscribe for more such videos! 🙌 🔔 Stay Connected: Subscribe: Developer Coder Chan...
Find the Prefix Common Array of Two Arrays | LeetCode 2657 | Java Code | Developer Coder
มุมมอง 157 ชั่วโมงที่ผ่านมา
Welcome to Developer Coder, your ultimate destination for solving challenging LeetCode problems! In this video, we dive into LeetCode 2657: Find the Prefix Common Array of Two Arrays. Learn how to approach this problem efficiently using Java and enhance your problem-solving skills. 🔑 Key Highlights: Expert insights and tips for solving this problem. Efficient coding strategies in Java. Perfect ...
Minimum Length of String After Operations | LeetCode 3223 | Java Code | Developer Coder
มุมมอง 329 ชั่วโมงที่ผ่านมา
Welcome to the Developer Coder channel! In this video, we’ll tackle the fascinating LeetCode problem "Minimum Length of String After Operations". Watch as we break down the problem and implement an efficient solution in Java! 🔔 Don’t forget to like, share, and subscribe for more coding content! 📌 What You’ll Learn: How to approach string-based operations. Optimizing performance with Java code. ...
Check if a Parentheses String Can Be Valid | LeetCode 2116 | Stacks | Java Code | Developer Coder
มุมมอง 2512 ชั่วโมงที่ผ่านมา
Welcome to Developer Coder, your go-to channel for mastering coding problems! 🎯 In this video, we tackle the exciting LeetCode problem "Check if a Parentheses String Can Be Valid". Learn how to solve this using Stacks and enhance your Java programming skills. 💻 📌 What you’ll learn in this video: How to use stacks for solving parentheses string problems. Efficient Java implementation for LeetCod...
Zigzag Grid Traversal With Skip | Weekly Contest 432 | Java Code | Developer Coder
มุมมอง 32312 ชั่วโมงที่ผ่านมา
#Google #Microsoft #Apple #Amazon #Facebook #IBM #Oracle #Cisco #Intel #Dell #HP #Adobe #Salesforce #SAP #NVIDIA #Tencent #Alibaba #Sony #Netflix #Baidu #Xiaomi #Qualcomm #VMware #Twitter #Fujitsu #Lenovo #Infosys #Capgemini #accenture Don't forget to subscribe my TH-cam channel for leetcode weekly contest solutions. - @DeveloperCoder
Construct K Palindrome Strings | LeetCode 1400 | 2 Approaches | Java Code | Developer Coder
มุมมอง 2514 ชั่วโมงที่ผ่านมา
Welcome to Developer Coder! In this video, we tackle the intriguing LeetCode problem "Construct K Palindrome Strings" (LeetCode 1400) using two powerful approaches: Count Odd Frequencies and Bit Manipulation. This Java-based tutorial dives deep into efficient problem-solving techniques, enhancing your algorithmic skills! 🚀 🛠 What you’ll learn in this video: Explanation of the problem statement ...
Word Subsets | LeetCode 916 | Time Complexity Explained | Java Code | Developer Coder
มุมมอง 2616 ชั่วโมงที่ผ่านมา
🚀 Welcome to Developer Coder! In this video, we tackle the LeetCode problem "Word Subsets" (LeetCode 916), diving deep into Time Complexity Analysis and explaining every aspect step-by-step. Whether you're a beginner or an advanced coder, this video will help you ace the "Word Subsets" problem using Java. 👨💻 Topics Covered: ✔️ Efficient approaches to solving "Word Subsets" ✔️ Time Complexity e...
Counting Words With a Given Prefix | LeetCode 2185 | Built-In Methods | Java Code | Developer Coder
มุมมอง 3219 ชั่วโมงที่ผ่านมา
Welcome to another exciting tutorial on 'Developer Coder'! In this video, we will tackle the LeetCode problem 2185: Counting Words With a Given Prefix. Using Java and leveraging built-in methods, we'll demonstrate an easy and efficient approach to solve this problem. 💡 This video is perfect for both beginners and intermediate programmers looking to enhance their problem-solving skills and maste...
Count Prefix and Suffix Pairs | LeetCode 3042 | Brute Force | Java Code | Developer Coder
มุมมอง 2921 ชั่วโมงที่ผ่านมา
Welcome to Developer Coder! In this video, we solve the exciting LeetCode problem Count Prefix and Suffix Pairs (3042) using a Brute Force approach. Watch to understand the Java implementation step by step, simplified for beginners and coding enthusiasts! 💻 🔍 What you'll learn in this video: The concept of prefix and suffix pairs in strings. Implementation of a brute force solution in Java. Tip...
Minimum Number of Operations to Move All Balls to Each Box | LeetCode 1769 | Java | Developer Coder
มุมมอง 39วันที่ผ่านมา
🚀 Welcome to Developer Coder! In this video, we explore the LeetCode problem "Minimum Number of Operations to Move All Balls to Each Box" (Problem #1769). This tutorial covers two efficient approaches: 1️⃣ Brute Force 2️⃣ Sum of Left and Right Moves 🔑 Learn step-by-step how to solve this problem using Java. Enhance your skills in array manipulation and efficient computation techniques. 🌟 What's...
Shifting Letters II | LeetCode 2381 | Difference Array Approach | Java Code | Developer Coder
มุมมอง 95วันที่ผ่านมา
🚀 Welcome to Developer Coder! In this video, we solve the LeetCode problem "Shifting Letters II" (Problem 2381) using the Difference Array Approach in Java. Perfect your coding skills with this step-by-step walkthrough! 👨💻 What's Covered in This Video? Implementation of the Difference Array Approach. Optimized coding techniques for handling multiple shift operations efficiently. Deep dive into...
Unique Length-3 Palindromic Subsequences | LeetCode 1930 | 2 Approaches | Java | Developer Coder
มุมมอง 26วันที่ผ่านมา
Welcome to Developer Coder! 🚀 In this video, we dive into solving LeetCode 1930: Unique Length-3 Palindromic Subsequences using two powerful approaches: 1️⃣ Count Letters In-Between 2️⃣ Pre-Compute First and Last Indices This video includes: ✅ A detailed explanation of the problem. ✅ Two optimized solutions using Java. ✅ A breakdown of critical concepts like palindromic subsequences, character ...
Number of Ways to Split Array | LeetCode 2270 | Java Code | Developer Coder
มุมมอง 4714 วันที่ผ่านมา
Welcome to Developer Coder! In this video, we dive into the exciting LeetCode problem "Number of Ways to Split Array." Explore how to tackle this problem using efficient Java programming techniques. Perfect for interview preparation and competitive coding enthusiasts! 📌 Key Topics Covered: Problem Insights Optimization Techniques Step-by-Step Java Code Implementation 👨💻 Stay tuned for more cod...
Count Vowel Strings in Ranges | LeetCode 2559 | Java Code | Developer Coder
มุมมอง 5914 วันที่ผ่านมา
Count Vowel Strings in Ranges | LeetCode 2559 | Java Code | Developer Coder
Maximum Score After Splitting a String | LeetCode 1422 | 3 Approaches | Java Code | Developer Coder
มุมมอง 4114 วันที่ผ่านมา
Maximum Score After Splitting a String | LeetCode 1422 | 3 Approaches | Java Code | Developer Coder
Minimum Cost For Tickets | LeetCode 983 | Recursion+Memoisation & DP | Java Code | Developer Coder
มุมมอง 2914 วันที่ผ่านมา
Minimum Cost For Tickets | LeetCode 983 | Recursion Memoisation & DP | Java Code | Developer Coder
Count Ways To Build Good Strings | LeetCode 2466 | DP (Iterative) | Java Code | Developer Coder
มุมมอง 2914 วันที่ผ่านมา
Count Ways To Build Good Strings | LeetCode 2466 | DP (Iterative) | Java Code | Developer Coder
Number of Ways to Form a Target String Given a Dictionary | Leetcode 1639 | | Java | Developer Coder
มุมมอง 3914 วันที่ผ่านมา
Number of Ways to Form a Target String Given a Dictionary | Leetcode 1639 | | Java | Developer Coder
Maximum Sum of 3 Non-Overlapping Subarrays | Leetcode 689 | Recursion | Java Code | Developer Coder
มุมมอง 7414 วันที่ผ่านมา
Maximum Sum of 3 Non-Overlapping Subarrays | Leetcode 689 | Recursion | Java Code | Developer Coder
Best Sightseeing Pair | Leetcode 1014 | Space-Optimized DP | Java Code | Developer Coder
มุมมอง 2921 วันที่ผ่านมา
Best Sightseeing Pair | Leetcode 1014 | Space-Optimized DP | Java Code | Developer Coder
Target Sum | Leetcode 494 | Compete Recursion Tree Diagram Memoisation | Java Code | Developer Coder
มุมมอง 3321 วันที่ผ่านมา
Target Sum | Leetcode 494 | Compete Recursion Tree Diagram Memoisation | Java Code | Developer Coder
Find Largest Value in Each Tree Row | Leetcode 515 | BFS | DFS | Java Code | Developer Coder
มุมมอง 4221 วันที่ผ่านมา
Find Largest Value in Each Tree Row | Leetcode 515 | BFS | DFS | Java Code | Developer Coder
Find Minimum Diameter After Merging Two Trees | Leetcode 3203 | BFS | Java Code | Developer Coder
มุมมอง 5221 วันที่ผ่านมา
Find Minimum Diameter After Merging Two Trees | Leetcode 3203 | BFS | Java Code | Developer Coder
Minimum Number of Operations to Sort a Binary Tree by Level | Leetcode 2471 | Java | Developer Coder
มุมมอง 5321 วันที่ผ่านมา
Minimum Number of Operations to Sort a Binary Tree by Level | Leetcode 2471 | Java | Developer Coder
Find Building Where Alice and Bob Can Meet | LeetCode 2940 | Monotonic Stack Java | Developer Coder
มุมมอง 16821 วันที่ผ่านมา
Find Building Where Alice and Bob Can Meet | LeetCode 2940 | Monotonic Stack Java | Developer Coder
Maximum Number of Distinct Elements After Operations | LeetCode 3397 | Weekly Contest 429 | Java
มุมมอง 6221 วันที่ผ่านมา
Maximum Number of Distinct Elements After Operations | LeetCode 3397 | Weekly Contest 429 | Java
Minimum Number of Operations to Make Elements in Array Distinct | LeetCode Weekly Contest 429
มุมมอง 41521 วันที่ผ่านมา
Minimum Number of Operations to Make Elements in Array Distinct | LeetCode Weekly Contest 429
Maximum Number of K-Divisible Components | Leetcode 2872 | DFS | Java Code | Developer Coder
มุมมอง 6721 วันที่ผ่านมา
Maximum Number of K-Divisible Components | Leetcode 2872 | DFS | Java Code | Developer Coder
excellent explanation thank you
Always welcome 😊
Best explanation love uu🎉🎉
Thanks so much! 😊 🙏
burayı bulabildiğime göre, bu günlük bu kadar yeter.
Very well explained keep going ❤ we want daily lc potd
@@thAsciNileshPal thanks 😊 🙏
import java.util.*; class Solution { public List<Integer> findMinHeightTrees(int n, int[][] edges) { if (n == 1) { return Collections.singletonList(0); } List<Integer> result = new ArrayList<>(); Map<Integer, List<Integer>> map = new HashMap<>(); // Build the adjacency list for (int[] edge : edges) { int u = edge[0]; int v = edge[1]; map.computeIfAbsent(u, k -> new ArrayList<>()).add(v); map.computeIfAbsent(v, k -> new ArrayList<>()).add(u); } Queue<Integer> leaves = new LinkedList<>(); // Add initial leaf nodes to the queue for (int node : map.keySet()) { if (map.get(node).size() == 1) { leaves.offer(node); } } while (n > 2) { int size = leaves.size(); n -= size; for (int i = 0; i < size; i++) { int leaf = leaves.poll(); int neighbor = map.get(leaf).iterator().next(); // Get the only neighbor map.get(neighbor).remove(Integer.valueOf(leaf)); // Remove leaf from neighbor's adjacency list if (map.get(neighbor).size() == 1) { leaves.offer(neighbor); } } } result.addAll(leaves); return result; } }
give the code
errors from EmployeeMapper = java: cannot find symbol symbol: method getLastName() location: variable employeeDto of type com.developer.coder.ems.dto.EmployeeDto also the same for employee too
Q2
Done...th-cam.com/video/-RDGxKQ5Pv0/w-d-xo.html
Bro, thumbnail??☠
😜
thank you
Lage raho bro ❤
DP: class Solution { public long minimumTotalDistance(List<Integer> robot, int[][] factory) { Collections.sort(robot); Arrays.sort(factory, Comparator.comparingInt(a -> a[0])); List<Integer> factoryPositions = new ArrayList<>(); for (int[] f : factory) { for (int i = 0; i < f[1]; i++) { factoryPositions.add(f[0]); } } int robotCount = robot.size(); int factoryCount = factoryPositions.size(); long[] next = new long[factoryCount+1]; long[] current = new long[factoryCount+1]; for( int i=robotCount -1;i>=0;i--){ //no factories left case if(i!= robotCount -1 ) next[factoryCount] = (long) 1e12; current[factoryCount] = (long) 1e12; for(int j = factoryCount -1 ;j>=0;j--){ //assign current robot to current factory long assign = Math.abs((long) robot.get(i) - factoryPositions.get(j)) + next[j+1]; //skip current factory for this robot long skip = current[j+1]; //take the min option current[j] = Math.min(assign,skip); } System.arraycopy(current,0,next,0,factoryCount+1); } return current[0]; } }
Recursion+Memo class Solution { public long minimumTotalDistance(List<Integer> robot, int[][] factory) { Collections.sort(robot); Arrays.sort(factory, Comparator.comparingInt(a -> a[0])); List<Integer> factoryPositions = new ArrayList<>(); for(int[] f : factory ){ for(int i=0;i<f[1];i++){ factoryPositions.add(f[0]); } } int robotCount = robot.size(); int factoryCount = factoryPositions.size(); long[][] memo = new long[robotCount][factoryCount]; for(long[] row: memo){ Arrays.fill(row, -1); } return calculateMinDistance(0,0, robot, factoryPositions, memo); } private long calculateMinDistance(int robotIdx, int factoryIdx, List<Integer> robot, List<Integer> factoryPositions, long[][] memo ){ //All robots assigned if(robotIdx == robot.size()) return 0; //No factories left to assign if(factoryIdx == factoryPositions.size()) return (long) 1e12; //check memo if(memo[robotIdx][factoryIdx] != -1){ return memo[robotIdx][factoryIdx]; } //option:1 assign current robot to current factory long assign = Math.abs(robot.get(robotIdx) - factoryPositions.get(factoryIdx)) + calculateMinDistance(robotIdx+1,factoryIdx+1, robot, factoryPositions, memo); //option:2 Skip current factory for the current robot long skip = calculateMinDistance(robotIdx,factoryIdx + 1, robot, factoryPositions, memo); memo[robotIdx][factoryIdx] = Math.min(assign,skip); return memo[robotIdx][factoryIdx]; } }
can you provide the code for both approaches
Sure, I have added the code in comments.😊
@@DeveloperCoder Thank brother
you should provide some soft copy of the code
Thanks for hint here is my solution which got accepted! Java class Solution { public int lengthAfterTransformations(String s, int t) { int mod=1000000007; int[] hash=new int[26]; int ans=0; for(int i=0;i<s.length();i++){ char c=s.charAt(i); hash[c-'a']++; } for(int i=0;i<t;i++){ int a=hash[25],b=hash[25]; hash[25]=0; for(int j=25;j>0;j--){ hash[j]=hash[j-1]; hash[j-1]=0; } hash[0]=a; hash[1]=(hash[1]+b)%mod; } for(int ele:hash){ ans=(ans%mod+ele)%mod; } return ans; } }
Nice explanation.. Keep it up bro👍
@@chaurasiyachaitanya6657 thanks 🙏☺️
sir pls explain how the code will work on it by step by step explain with example
Please try 🎧 incase voice is not clear and audible. Getting some issues with the old recorder.😊
2 pointers: (Sliding Window) (Time Complexity) Let n be the total number of elements across all lists and k be the number of lists. Time complexity: O(nlogn) The first nested loop iterates over k lists, and for each list, it iterates through its elements. In the worst case, this requires O(n) time since we are processing all elements once. After merging, we sort the merged array which contains n elements. Sorting has a time complexity of O(nlogn). The two-pointer approach iterates through the merged list once (with the right pointer) and may also move the left pointer forward multiple times. In total, each pointer will traverse the merged list at most n times. Combining these steps, the overall time complexity is: O(nlogn)
Priority Queue: (Time Complexity) Let n be the total number of elements across all lists and k be the number of lists. Time complexity: O(nlogk) The initial loop that inserts the first element from each list into the priority queue runs in O(k). The while loop continues until we have exhausted one of the lists in the priority queue. Each iteration of the loop involves: Extracting the minimum element from the priority queue, which takes O(logk). Inserting a new element from the same list into the priority queue, which also takes O(logk). In the worst case, we will process all n elements, leading to a total complexity of O(nlogk).
Brute Force: (Time Complexity ) Let n be the total number of elements across all lists and k be the number of lists. Time complexity: O(n⋅k) In each iteration of the while (true) loop, we traverse all k lists to find the current minimum and maximum. This takes O(k) time. The loop continues until at least one of the lists is fully traversed. In the worst case, every element from every list is visited, and the total number of elements across all lists is n. Therefore, the loop runs O(n) times. Overall, the time complexity becomes O(n⋅k).
Using Arrays: class CustomStack { private int[] stack; // Array to store the stack elements private int top; // Pointer to the top of the stack private int maxSize; // Maximum size of the stack // Constructor to initialize the stack and set the maximum size public CustomStack(int maxSize) { this.stack = new int[maxSize]; // Fixed-size array for the stack this.top = -1; // Initialize top as -1 (empty stack) this.maxSize = maxSize; } // Pushes an element onto the stack if there's space public void push(int x) { if (top < maxSize - 1) { // Check if there's space in the stack top++; // Move top pointer to the next empty spot stack[top] = x; // Add element to the stack } } // Pops and returns the top element of the stack, or -1 if it's empty public int pop() { if (top == -1) { // If the stack is empty, return -1 return -1; } else { return stack[top--]; // Return top element and decrement the top pointer } } // Increments the bottom k elements by val public void increment(int k, int val) { int limit = Math.min(k, top + 1); // Find how many elements we can increment for (int i = 0; i < limit; i++) { stack[i] += val; // Increment each of the bottom k elements } } } /** * Your CustomStack object will be instantiated and called as such: * CustomStack obj = new CustomStack(maxSize); * obj.push(x); * int param_2 = obj.pop(); * obj.increment(k,val); */
Some more ways to solve this problem: Using ArrayList : class CustomStack { private ArrayList<Integer> stack; private int maxSize; public CustomStack(int maxSize) { this.stack = new ArrayList<>(); this.maxSize = maxSize; } // Pushes an element to the top of the stack if it hasn't reached the max size public void push(int x) { if (stack.size() < maxSize) { stack.add(x); } } // Pops and returns the top element of the stack or -1 if the stack is empty public int pop() { if (stack.isEmpty()) { return -1; } else { return stack.remove(stack.size() - 1); // Removes the top element } } // Increments the bottom k elements by val public void increment(int k, int val) { int limit = Math.min(k, stack.size()); // Ensures we don't exceed the stack size for (int i = 0; i < limit; i++) { stack.set(i, stack.get(i) + val); // Increment each of the bottom k elements } } }
sir can you give the code for string approach for the above problem
String approach is not efficient enough for larger input sizes. With below approach, you won't be able to submit the solution. Only 30/38 testcases are getting passed class Solution { public int[] sumPrefixScores(String[] words) { int n = words.length; int[] result = new int[n]; // Iterate through each word in the array for (int i = 0; i < n; i++) { String word = words[i]; int score = 0; // Iterate through all prefixes of the word for (int j = 1; j <= word.length(); j++) { String prefix = word.substring(0, j); // Count how many words start with the current prefix for (String w : words) { if (w.startsWith(prefix)) { score++; } } } // Store the total score for the current word result[i] = score; } return result; } } The Trie data structure is the optimal choice for efficiently solving the prefix score problem, especially for larger inputs. It allows for quick insertion and lookup of prefixes, resulting in a more scalable solution. Try to solve this and yesterday's problem with Trie; you will be able to understand better.
thanks for the explanation sir
Always welcome :)
clear English, written out dry run, best explanation on youtube for this question! including time/space at the end would make this video a bit better. thank you!
Hello brother, your tutorials are really helpful. I would like to contact you, if possible share your contact info..
Thank you😊😊. Please feel free to contact me : Email: iamcoderdeveloper@gmail.com
Nice
Thanks
Nice one
Bro please, first explain the problem then explain the solution , because it'll give us the time to try it by ourselves.. cause most newbies like me can't understand the problem like this ..
Sure...I am doing the same for daily problems... will implement your suggestion in upcoming weekly contest solutions.
NICE SUPER EXCELLENT MOTIVATED
Thanks for daily problem videos
Hey please share this project GitHub link
Note: Please use earphones 🎧 for better audio quality. I hope everyone is able to send the data and get the list of employees using frontend part. If you have any queries, please let me know in the comments!!!! Consistency is the 🗝️ key to success!!!
nice one
@@abhibhosale6877 thanks 🙏
Approach 2 (Without using Map): import java.util.*; class Solution { public double maxProbability(int n, int[][] edges, double[] succProb, int start_node, int end_node) { List<double[]>[] graph = new List[n]; for (int i = 0; i < n; i++) { graph[i] = new ArrayList<>(); } for (int i = 0; i < edges.length; i++) { int u = edges[i][0]; int v = edges[i][1]; double p = succProb[i]; graph[u].add(new double[]{v, p}); graph[v].add(new double[]{u, p}); } PriorityQueue<double[]> pq = new PriorityQueue<>((a, b) -> Double.compare(b[1], a[1])); pq.add(new double[]{start_node, 1.0}); double[] r = new double[n]; r[start_node] = 1.0; while (!pq.isEmpty()) { double[] curr = pq.poll(); int u = (int) curr[0]; double p = curr[1]; if (u == end_node) { return p; } for (double[] neighbor : graph[u]) { int v = (int) neighbor[0]; double prob = p * neighbor[1]; if (prob > r[v]) { r[v] = prob; pq.add(new double[]{v, prob}); } } } return 0.0; } }
Thank you so much! I was struggling to understand Spring Boot even after reading the documentation and searching everywhere, but this video explained it perfectly. As someone new to Spring Boot, this really helped me a lot!
Thank you so much for your kind words! 🌟 I'm really glad the video helped you understand Spring Boot better. It can be challenging when you're just starting out, but you're doing great by taking the time to learn. Keep up the awesome work, and if you have any more questions or topics you'd like to see, feel free to ask! 🚀😊
Hi Everyone, I hope you’ve all completed the backend and frontend tasks to retrieve the list of employees. If you’re encountering any issues, please let me know in the comments. Note: For better audio quality, please use earphones. There was an issue with the recorder that I discovered only after the recording was finished.
Your audio is very hard to hear
@@davidtrame8280 Yes, please use earphones. There was an issue with the recorder that I discovered only after it was finished.
NICE SUPER EXCELLENT MOTIVATED
@@ganeshjaggineni4097 Thanks ☺️
Use some light IDEs and create some moderate type projects using React and Spring Boot
Thank you for the suggestion! For Spring Boot, I recommend Eclipse or IntelliJ IDEA due to their strong Java support. For React, I prefer Visual Studio Code for its lightweight and customizable environment. If you have any specific project or topics in mind, I'd love to hear them!
@@DeveloperCoder I have suggested you to use a light background theme so that the code is visible and please create a project series like a movie ticket website or some hotel management using React as Front End and Spring Boot as Backend
@@PallabChatterjee-n7x Sure thing!! Once this Employee management System frontend is done, will do others.
Part 1 : th-cam.com/video/YxrJ-H7U8Ag/w-d-xo.html
✅
Nicely explained..
@@rohitsingh1350 thanks ☺️
I didn't have much time today, so I put this video together quickly to help you maintain your daily streak. If you have any questions or need further clarification, please let me know, and I'll do my best to provide a detailed explanation. Thank you for your understanding and support.😊
I did not understand the input. We are provided with a 2D integer array and the input is string. And we haven't mentioned strings anywhere in the program and we are not checking with the string value then how are we able to determine if adjacent or diagonal value is asked. Can anyone explain?
We have to just define the methods, that's all. We don't need to call anything from our side...in background it is calling everything itself... 1. List of Operations This is a list of strings indicating the type of operations or queries to perform: "neighborSum" "adjacentSum" "adjacentSum" "diagonalSum" "diagonalSum" 2. List of Parameters This list provides the parameters required for each operation: The first element is a 3x3 matrix: [[[0, 1, 2], [3, 4, 5], [6, 7, 8]]] The remaining elements are parameters for each operation in the form of integers or indices: [1], [4], [4], [8] Explanation of the Operations with Parameters: "neighborSum" with parameters [[[0, 1, 2], [3, 4, 5], [6, 7, 8]]]: The operation "neighborSum" likely calculates the sum of neighboring elements around a specified cell in the matrix. "adjacentSum" with parameter [1]: The operation "adjacentSum" is applied to the cell located at index [1] (in a flat representation of the matrix or a specific cell). "adjacentSum" with parameter [4]: Similarly, this operation "adjacentSum" is applied to the cell located at index [4]. "diagonalSum" with parameter [4]: The "diagonalSum" operation calculates the sum of elements along the diagonals passing through the cell at index [4]. "diagonalSum" with parameter [8]: This operation "diagonalSum" calculates the sum of elements along the diagonals passing through the cell at index [8].
@@DeveloperCoder Thanks a lot for explaining in detail. I really appreciate your efforts
Please
Bro 2nd question ka solution
How can they term it as "EASY"?