A quick guide to the Stack data structure. Learn LIFO, push/pop, and where stacks appear in real algorithms. Mentoring 👉 https://rebeloper.com/ #datastructures #algorithms #codinginterview #programming #softwaredev
More Relevant Posts
-
Day 72 – Combinations and Combination Sum: Backtracking Breadth 🔢🌿Today's session explored two classic backtracking problems generating combinations with and without repetition each building recursive patterns for exhaustive yet efficient search. 🌿 Combinations I generated all k length combinations from 1 to n using similar backtracking choosing or skipping each number while building toward size k. A clean exercise in controlled recursion without repetition. 🔢 Combination Sum I implemented backtracking with a sorted array to allow pruning. At each step, I chose candidates starting from the current index (allowing reuse) and recursively built toward the target, backtracking when exceeded or matched. Achieved exponential time complexity with effective pruning through sorting and index control. #LeetCode #Coding #Algorithms #Backtracking #Recursion #CombinationSum #Combinations #ProblemSolving #SoftwareEngineering #Programming #100DaysOfCode
To view or add a comment, sign in
-
Practiced an interesting array problem today: Majority Element. What I understood from this problem was that not all meaningful learning comes from complex topics like dynamic programming or backtracking. Sometimes, even simpler problems create room to think more deeply about optimization. This problem has a very straightforward solution using hashing, but it also led me to explore how much the solution could be optimized in terms of space. That’s when I came across the Boyer–Moore Majority Vote Algorithm. The idea behind it is quite intuitive. Instead of explicitly counting every element, we maintain a candidate and a counter . As we iterate through the array, matching elements increase the count, while different elements decrease it. Over time, elements effectively "cancel each other out". Since the majority element appears more than ⌊n/2⌋ times, it ends up being the final candidate after all cancellations. Problems like this are a good reminder that sometimes the real value lies not just in solving a problem, but in exploring how far an idea can be optimized. ⚡ #softwareengineering #leetcode #algorithms #dsa #coding #programming #problemSolving #computerscience
To view or add a comment, sign in
-
-
Day 43 on LeetCode — Squares of a Sorted Array ✅ Today’s problem focused on two-pointer technique and handling absolute values for efficient array transformation. 🔹 Approach Used in My Solution The goal was to return a sorted array of squares from a non-decreasing sorted input array, which may contain negative numbers. Key points in the logic: • Use two pointers at the start (left) and end (right) of the array • Compare absolute values of elements at both ends • Place the larger square at the current last position in the result array (pos) • Move the pointer of the larger absolute value and fill the result array from back to front • Continue until all elements are squared and placed This ensures a single-pass O(n) solution without extra sorting. ⚡ Complexity: • Time Complexity: O(n) • Space Complexity: O(n) 💡 Key Takeaways: • Practiced the two-pointer technique for array transformations • Learned to handle negative numbers when squaring • Strengthened understanding of in-place logic using a separate result array #LeetCode #DSA #Algorithms #DataStructures #Arrays #TwoPointers #ProblemSolving #Coding #Programming #Cpp #STL #SoftwareEngineering #ComputerScience #CodingPractice #DeveloperLife #TechJourney #CodingDaily #100DaysOfCode #BuildInPublic #AlgorithmPractice #CodingSkills #Developers #TechCommunity #SoftwareDeveloper #EngineeringJourney
To view or add a comment, sign in
-
-
🚀 19 of #100DaysOfCode Solved LeetCode 1456 – Maximum Number of Vowels in a Substring of Given Length today. 🔍 Approach: Used the Sliding Window Technique to efficiently track the number of vowels in a substring of size k. Instead of recalculating vowels for every substring, we adjust the count as the window slides forward. 💡 Key Idea: Add the new character entering the window. Remove the character leaving the window. Keep track of the maximum vowel count. ⏱ Time Complexity: O(n) 📦 Space Complexity: O(1) This approach optimizes the brute-force solution and makes the algorithm scalable for large inputs. Consistent practice is helping me strengthen my problem-solving and data structures fundamentals. #leetcode #dsaalgorithms #slidingwindow #cpp #codingpractice #programming #softwaredevelopment #100daysofcode #developers #techlearning
To view or add a comment, sign in
-
-
Day 45 on LeetCode — Sort Colors 🎨✅ Today’s problem focused on counting technique and efficient array reconstruction. 🔹 Approach Used in My Solution Instead of sorting using a traditional algorithm, I applied a counting approach. Since the array only contains three possible values (0, 1, and 2), we can simply count their frequencies and rebuild the array. Key steps in the logic: • Traverse the array and count occurrences of 0s, 1s, and 2s using a small count array • Refill the original array based on these counts • Place all 0s first, followed by 1s, and then 2s This method avoids unnecessary comparisons and keeps the logic simple and efficient. ⚡ Complexity: • Time Complexity: O(n) • Space Complexity: O(1) 💡 Key Takeaways: • Counting techniques can simplify problems with limited value ranges • Practiced frequency counting and array reconstruction • Reinforced writing clean linear-time solutions #LeetCode #DSA #Algorithms #DataStructures #Arrays #CountingSort #ProblemSolving #Coding #Programming #Cpp #STL #SoftwareEngineering #ComputerScience #CodingPractice #DeveloperLife #TechJourney #CodingDaily #100DaysOfCode #BuildInPublic #AlgorithmPractice #CodingSkills #Developers #TechCommunity #SoftwareDeveloper #EngineeringJourney
To view or add a comment, sign in
-
-
Day 40 on LeetCode — Longest Consecutive Sequence ✅ Today’s challenge was about finding the longest sequence of consecutive numbers in an unsorted array. 🔹 Approach Used in My Solution In my implementation, I first sorted the array, which makes consecutive numbers appear next to each other. After sorting, I traversed the array once to track the current streak of consecutive numbers. Key points in the logic: • Skip duplicates to avoid breaking the sequence • Increase the counter when the current number is exactly previous + 1 • Reset the counter when the sequence breaks and update the longest streak This approach keeps the implementation simple, readable, and effective. ⚡ Complexity: • Time Complexity: O(n log n) due to sorting • Space Complexity: O(1) (excluding sorting space) 💡 Key Takeaways: • Sorting can simplify many sequence detection problems • Careful handling of duplicates is important in consecutive sequence problems • Reinforces writing clean traversal logic after preprocessing #LeetCode #DSA #Algorithms #DataStructures #Arrays #Sorting #ProblemSolving #Coding #Programming #Cpp #STL #SoftwareEngineering #ComputerScience #CodingPractice #DeveloperLife #TechJourney #CodingDaily #100DaysOfCode #BuildInPublic #AlgorithmPractice #CodingSkills #Developers #TechCommunity #SoftwareDeveloper #EngineeringJourney
To view or add a comment, sign in
-
-
Understand the Stack data structure in minutes. Push, pop, LIFO and where stacks appear in real algorithms. Mentoring 👉 https://rebeloper.com/ #datastructures #algorithms #codinginterview #programming #developer
To view or add a comment, sign in
-
I looked into trade offs between quick sort and merge sort. So I asked myself when to use quick sort vs merge sort? Both are a form of divide and conquer. Quick sort uses a pivot point which creates a risk of imbalanced partitions with a worst case time complexity of O(n^2). Merge sort has a time complexity that shares both best and worst case scenarios of O(n Log n), but it uses more overhead since it creates deep copies of the data. Sorting algorithms are truly fascinating! #algo #algorithms #DSA #DataStructuresAlgorithms #DataStructuresAndAlgorithms #MergeSort #QuickSort #SDE #SWE #SoftwareDevloper #SoftwareEngineer #ComputerScience #programming
To view or add a comment, sign in
-
Thanks to Wes Bos - I found the most important part of Claude's leaked codebase. ... List with all spinner verbs. 😁 Everyone’s talking about the latest code leak. But here’s the real takeaway: Code reviewes matters more than ever It’s tempting to trust generated code when it looks clean and works on first run. But you can produce - Hidden edge cases - Subtle security issues - Performance regressions - Incorrect assumptions masked by confident output If you’re shipping AI-assisted code: - Always review every change - Treat outputs like junior-level contributions - Test beyond the happy path - Question why , not just does it work Use the tools. Don't outsource your thinking. #ArtificialIntelligence #SoftwareEngineering #CodeReview #GenerativeAI #Programming
To view or add a comment, sign in
-
Not all data structures think the same… some give you freedom, others demand discipline. 🔹 Array → Freedom to access anything, anytime 🔹 Queue → Strict order, one way in — one way out 💡 One is about speed & flexibility 💡 The other is about structure & fairness And that’s the real lesson 👇 👉 In coding (and life), knowing WHEN to use WHAT matters more than knowing EVERYTHING. 🔥 Think about it: Need instant access? → Array wins Need ordered processing? → Queue dominates #DataStructures #Algorithms #Programming #Coding #DSA #ComputerScience #SoftwareEngineering #Developers #LearnToCode #CodingLife #Tech #Engineering #ProblemSolving #LinkedInLearning #CareerGrowth #CodeNewbie
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