🔥 Day 98 of #100DaysOfCode Today’s problem was all about string manipulation and greedy thinking — solving the Alternating Characters challenge. 💡 Problem Summary: Given a string of only A and B, the goal is to make sure no two adjacent characters are the same by deleting the minimum number of characters. 🧠 Approach: Instead of trying all possibilities, I used a simple and efficient strategy: Traverse the string once Compare each character with the previous one If they are the same → increment deletion count ⚡ Key Insight: Every pair of matching adjacent characters contributes exactly 1 deletion. 📊 Complexity: Time: O(n) Space: O(1) 🧪 Example: AAABBB → 4 deletions ABABAB → 0 deletions ✨ What I Learned: Sometimes the simplest greedy approach beats complex logic. Recognizing patterns in strings is a powerful skill in problem-solving! 💻 Language Used: C #Day98 #100DaysOfCode #CodingChallenge #DataStructures #Algorithms #CProgramming #ProblemSolving #DeveloperJourney
Alternating Characters Challenge Solution in C
More Relevant Posts
-
🔥 Day 76 of #100DaysOfCode Solved Climbing Stairs (LeetCode 70) today — a classic Dynamic Programming problem 🚀 At first, it looks simple… but the real learning is in identifying the pattern behind it. 💡 Key Insight: Each step depends on the previous two steps. That’s when it clicked — this is basically a Fibonacci pattern in disguise. Instead of using recursion (which is slow), I used an optimized iterative approach to achieve: ⚡ O(n) time complexity ⚡ O(1) space complexity 📈 Result: ✅ 100% runtime ✅ 90%+ memory efficiency This problem taught me: 👉 Always look for patterns before jumping into coding 👉 Optimization matters as much as correctness Small problems → Big concepts #Day76 #LeetCode #DynamicProgramming #CodingJourney #ProblemSolving #LearnInPublic
To view or add a comment, sign in
-
-
Day 5 of #100DaysOfCode – Thinking Beyond Basics! Today’s coding session pushed me to explore number-based logic in depth 🧠💻 It wasn’t just about writing programs… It was about understanding patterns hidden inside numbers 🔍 ✨ What I worked on today (Programs 51–60): 🔹 Unique number concepts ✔️ Neon Number ✔️ Spy Number ✔️ Automorphic Number ✔️ Harshad Number ✔️ Disarium Number 🔹 Core logic building ✔️ Sum of even & odd series ✔️ Power calculations ✔️ Digit frequency & manipulation 💡 Key Insight: Numbers are not just values… They carry patterns, properties, and logic ⚡ Debugging + practicing these concepts helped me improve my analytical thinking 🔥 Every day I’m moving from: 👉 Writing code → to understanding logic deeply 💬 Consistency is becoming my biggest strength! Global Quest Technologies ✨ #100DaysOfCode #Day5 #Python #PythonProgramming #CodingJourney #ProblemSolving #LearnPython #DeveloperMindset #TechSkills #SoftwareDevelopment #CodingLife #Consistency #FutureDeveloper #GlobalQuestTechnologies #GQT
To view or add a comment, sign in
-
Day 4 of #100DaysOfCode – Building Strong Logic Step by Step! Today’s session was all about improving logical thinking and mastering basics that matter in real coding Instead of just writing code, I focused on understanding how and why things work 👇 ✨ What I practiced today (Programs 41–50): 🔹 Working with numbers & conditions ✔️ Positive / Negative / Zero check ✔️ Sum of even & odd numbers ✔️ Sum of first N natural numbers 🔹 String & character handling ✔️ Word count in a sentence ✔️ ASCII value of characters ✔️ Identifying alphabets, digits & special characters 🔹 Logic building with loops ✔️ Multiplication tables ✔️ Strong number concept 🔹 Data insights ✔️ Finding differences in lists 💡 Key Learning: Simple problems = Strong foundation The more I practice, the more I realize: 👉 Logic is everything in programming ⚡ Every small program today is preparing me for bigger real-world problems tomorrow 🔥 Consistency is turning effort into skill! Global Quest Technologies ✨ #100DaysOfCode #Day4 #Python #PythonProgramming #CodingJourney #ProblemSolving #LearnPython #DeveloperMindset #TechSkills #SoftwareDevelopment #CodingLife #Consistency #FutureDeveloper #GlobalQuestTechnologies #GQT
To view or add a comment, sign in
-
🚀 Day 69 of #100DaysOfCode 🔥 Problem: Majority Element II (LeetCode 229) Today’s challenge was all about finding elements that appear more than ⌊n/3⌋ times in an array. Sounds simple, but the twist is doing it efficiently! 💡 Key Insight: Instead of counting frequencies using extra space, we can use an optimized approach based on the Boyer-Moore Voting Algorithm. ✨ Approach Highlights: • There can be at most 2 majority elements (> n/3) • Maintain 2 candidates and their counts • First pass → find potential candidates • Second pass → verify their frequency ⚡ Why this works? Because any element appearing more than n/3 times will survive the elimination process. 📈 Complexity: • Time: O(n) • Space: O(1) 🎯 Takeaway: Smart algorithms > brute force. Understanding patterns like voting algorithms can save both time and space! #DSA #LeetCode #CodingJourney #ProblemSolving #100DaysOfCode #Algorithms #Programming
To view or add a comment, sign in
-
-
🚀 Day 19/100: Event Listeners & The Turtle Race! 🐢🏁 💡 Did you know? The concept of "Event-Driven Programming" is what allows your computer to respond to a mouse click or a key press. Without it, software would just run in a straight line without ever listening to the user! I’ve reached Day 19 of #100DaysOfCode! Today was all about moving from "static" code to "interactive" systems by using Event Listeners and Higher-Order Functions. Key technical takeaways: ✅ Event Listeners: Using `.listen()` and `.onkey()` to make the program respond to keyboard inputs. ✅ Higher-Order Functions: Passing one function into another as an argument—a powerful concept for building flexible code. ✅ State & Multiple Instances: Creating multiple "Turtle" objects from the same class, each with its own state (color, position, speed). ✅ Game Logic: Building a betting system where the user predicts the winner of a randomized race. Learning how to make code "listen" is the first step toward building real-world applications that users can actually interact with! 🛡️ Check out the "Turtle Derby" here: 🔗https://lnkd.in/gY7dH6Xg Nineteen days of consistent training. Day 20, let's keep the pace! 🚀 #Python #100DaysOfCode #EventDrivenProgramming #GameDev #TurtleGraphics #CodingChallenge #DevCommunity
To view or add a comment, sign in
-
🚀 Day 42 of #GeekStreak60 ✅ Problem Solved: Consecutive 1's Not Allowed Today’s problem looked simple at first, but it turned into a really clean Dynamic Programming pattern. The task was to count all binary strings of length "n" such that no two 1’s are consecutive. Instead of generating all possibilities (which would be exponential), I learned how to break it down using a recurrence relation. The key observation was that a valid string ending with "0" can come from any valid string of length "n-1", while a string ending with "1" must come from a string of length "n-2". This leads to a Fibonacci-like relation, making the solution efficient and elegant. 💡 Key Takeaways: • Recognizing patterns (like Fibonacci) simplifies complex problems • DP is powerful when overlapping subproblems exist • Thinking in terms of “choices at each step” is a game changer 📈 Consistency > Motivation 🔥 Current Streak: 42 days Let’s keep building, one problem at a time. #DSA #DynamicProgramming #CodingJourney #ProblemSolving #GeeksforGeeks #100DaysOfCode #Consistency #Learning #Growth
To view or add a comment, sign in
-
-
A webassembly fueled LLM driven programming language? Couple this with spacetimedb's 100,000 transactions per second on a single machine - and I think something interesting could happen. This seems like the origins of a pretty interesting development framework. https://spacetimedb.com/ https://veralang.dev/
To view or add a comment, sign in
-
Day 88 on LeetCode Add Two Numbers 🔗➕💡 A classic linked list problem focusing on digit-wise addition with carry handling. 🔹 Approach Used in My Solution • Traverse both linked lists simultaneously • Maintain a carry variable for overflow • Add corresponding node values + carry • Create new nodes for result using a dummy head • Continue until both lists and carry are fully processed ⚡ Complexity: • Time Complexity: O(max(n, m)) • Space Complexity: O(max(n, m)) 💡 Key Takeaways: • Dummy node simplifies linked list construction • Carry handling is the core concept in this problem • Reinforces simulation of real-world arithmetic using linked lists 🔥 Another step forward in strengthening pointer-based problem solving. #LeetCode #DSA #Algorithms #DataStructures #LinkedList #AddTwoNumbers #CarryLogic #ProblemSolving #Coding #Programming #Cpp #STL #SoftwareEngineering #ComputerScience #CodingPractice #DeveloperLife #TechJourney #CodingDaily #Consistency #100DaysOfCode #BuildInPublic #AlgorithmPractice #CodingSkills #Developers #TechCommunity #SoftwareDeveloper #EngineeringJourney
To view or add a comment, sign in
-
-
Day 87 on LeetCode — Flatten a Multilevel Doubly Linked List 🔗🧠🔥 Now this was a next-level linked list problem — combining recursion with pointer manipulation 💯 🔹 Flatten a Multilevel Doubly Linked List The goal was to convert a multilevel list (with child pointers) into a single-level doubly linked list. 🔹 Approach Used in My Solution (DFS + Recursion) Key idea: • Traverse the list node by node • If a node has a child: – Recursively flatten the child list – Insert the flattened child between current node and next node – Connect prev and next pointers properly – Set child = nullptr • Maintain a last pointer to track the tail of the flattened part This is essentially a DFS traversal on a linked list structure. ⚡ Complexity: • Time Complexity: O(n) • Space Complexity: O(n) (due to recursion stack) 💡 Key Takeaways: • Combined recursion + pointer manipulation effectively • Learned how to flatten hierarchical structures using DFS thinking • Careful handling of next, prev, and child pointers is critical 🔥 This is where linked lists start feeling like real problem-solving, not just traversal. #LeetCode #DSA #Algorithms #DataStructures #LinkedList #DoublyLinkedList #Recursion #DFS #ProblemSolving #Coding #Programming #Cpp #STL #SoftwareEngineering #ComputerScience #CodingPractice #DeveloperLife #TechJourney #CodingDaily #Consistency #100DaysOfCode #BuildInPublic #AlgorithmPractice #CodingSkills #Developers #TechCommunity #SoftwareDeveloper #EngineeringJourney
To view or add a comment, sign in
-
-
Day 77 on LeetCode Find Smallest Letter Greater Than Target 🔤🔍✅ Continuing the streak with a clean Binary Search application — keeping things simple and consistent during mids 💯 🔹 Approach Used in My Solution The goal was to find the smallest character strictly greater than the target in a sorted array, with wrap-around behavior. Key idea: • Apply binary search on the sorted array • Whenever letters[mid] > target, store it as a potential answer • Move left to find an even smaller valid character • If no such character exists, return letters[0] (wrap-around case) This ensures we always get the next greatest letter efficiently. ⚡ Complexity: • Time Complexity: O(log n) • Space Complexity: O(1) 💡 Key Takeaways: • Practiced binary search for “next greater element” problems • Learned how to handle wrap-around edge cases • Reinforced writing clean and optimized search logic 🔥 Small wins every day consistency is the real progress. #LeetCode #DSA #Algorithms #DataStructures #BinarySearch #Arrays #ProblemSolving #Coding #Programming #Cpp #STL #SoftwareEngineering #ComputerScience #CodingPractice #DeveloperLife #TechJourney #CodingDaily #Consistency #100DaysOfCode #BuildInPublic #AlgorithmPractice #CodingSkills #Developers #TechCommunity #SoftwareDeveloper #EngineeringJourney
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