Day 24/100 – DSA Journey Problem: Intersection of Two Arrays Initially thought of using loops, but that would increase time complexity. Then realized the problem requires only unique common elements, which makes sets a perfect fit. Converted both arrays into sets and used intersection to directly get the result in an efficient way. Key Learning: Choosing the right data structure can simplify the entire problem. #Day24 #100DaysOfCode #DSA #Python #LeetCode #ProblemSolving
Intersection of Two Arrays with Sets in Python
More Relevant Posts
-
Day 32 / #120DaysOfCode – LeetCode Challenge Today’s focus: Arrays & Majority Voting Algorithm ✅ Problem Solved: • Majority Element II 💻 Language: Python 📚 Key Learnings: • Applied Boyer-Moore Voting Algorithm (extended version) • Learned how to track two candidates for n/3 majority • Understood the importance of validation step after candidate selection • Improved ability to handle edge cases in frequency problems Consistency builds confidence 🚀 Every day = 1% better 💪 🔗 LeetCode Profile: https://lnkd.in/gbeMKcv5 #LeetCode #Python #DSA #Arrays #Algorithms #Consistency #CodingJourney #120DaysOfCode
To view or add a comment, sign in
-
-
Today, I learned how to take user input in Python using the input() function. This allows programs to interact with users and collect data such as name, age, and city. I also learned how to convert input into numbers using int() and float(), which is very important for calculations and data processing. #Day2 #Python #LearningJourney #DataScience #MachineLearning #Consistency
To view or add a comment, sign in
-
Day 110 Same pattern, new constraint. #Day110 🧩 90. Subsets II How today went: • Very similar to the basic Subsets problem • First step: sort the array • While iterating, skip duplicate elements to avoid repeating subsets • Use the same backtracking pattern: append → recurse → pop What I learned: The core pattern stays the same — only the duplicate handling logic changes. This small condition makes a big difference. Backtracking is becoming more predictable now. #LeetCode #DSA #Python #Backtracking #Recursion #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
🚀 Solved today’s GeeksforGeeks Problem of the Day: Intersection of Two Sorted Arrays using Python 🐍 Problem: Find the distinct common elements between two sorted arrays. Approach: Used the efficient Two Pointer Technique 👇 ✔ Traverse both arrays simultaneously ✔ Compare elements and move pointers accordingly ✔ Skip duplicates to ensure unique results 💡 Key Insight: Since arrays are already sorted, we can avoid extra data structures and solve it in O(n + m) time. 💡 Concepts Used: Two Pointers | Arrays | Duplicate Handling This problem is a great example of how understanding input properties (sorted arrays) can drastically optimize your solution 🚀 #geekstreak60 #geeksforgeeks #dsa #python #coding #problemSolving #arrays #twopointers
To view or add a comment, sign in
-
-
Get started with machine learning using Python and discover how to build intelligent systems that can learn from data and improve their performance over time with this comprehensive guide https://lnkd.in/gDJ28K-Y #MachineLearningWithPython Read the full article https://lnkd.in/gDJ28K-Y
To view or add a comment, sign in
-
-
Day 42 of consistency 🚀 Today’s problem was about counting binary strings of length n without consecutive 1s. A simple-looking question, but it beautifully turns into a DP + Fibonacci pattern problem. Key takeaway: not every counting problem needs brute force — sometimes, just tracking valid endings is enough. Little by little, these patterns start repeating — and that’s where real improvement happens. #GeeksforGeeks #DSA #Python #DynamicProgramming #CodingJourney #ProblemSolving #100DaysOfCode #geekstreak60 #npci
To view or add a comment, sign in
-
-
Day 117 Same pattern, one important tweak. #Day117 🧩 90. Subsets II How today went: • Same base as Subsets • First step: sort the array • While iterating, skip duplicates to avoid repeating subsets • Use the same pattern: append → recurse → pop What I learned: It’s not a new problem — it’s the same pattern with a duplicate filter. Small condition. Big impact. Backtracking is starting to feel predictable. #LeetCode #DSA #Python #Backtracking #Recursion #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
Day 43/100 – #100DaysOfCode 🚀 Solved LeetCode #2610 – Convert an Array Into a 2D Array With Conditions (Python). Today I practiced hashmap (frequency counting) to construct a 2D array based on given conditions. Approach: 1) Create a frequency map to count occurrences of each element. 2) Initialize an empty result list. 3) While the frequency map is not empty: 4) Create a new row. 5) Iterate through keys and add each number once to the row. 6) Decrease its frequency and remove it if it becomes zero. 7) Add the row to the result. 8) Return the final 2D array. Time Complexity: O(n) Space Complexity: O(n) Learning how frequency maps help in structuring data efficiently 💪 #LeetCode #Python #DSA #HashMap #Arrays #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Day 39 at Luminar Technolab Focused on data manipulation in Pandas adding columns, sorting values, and filtering using conditions. Also explored useful methods like head() and tail() for quick data insights. #Python #Pandas #DataAnalysis #LearningJourney #Consistency
To view or add a comment, sign in
-
Day 50/60 #geekstreak60 Solved Intersection of Two Sorted Arrays today. A simple yet important problem that highlights the efficiency of the two-pointer approach — allowing us to find common elements in O(n + m) time while handling duplicates smartly. Problems like these may look basic, but they strengthen core DSA thinking and improve logic with every step. 💻 #geekstreak60 #npci #DSA #Python #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development