🧠 Day 20 of #100DaysOfDSA Today I practiced two classic problems from LeetCode — FizzBuzz and Reverse String. 📘 What I learned: These might look like simple problems, but they help sharpen logic building, loops, and condition handling — essential building blocks for bigger challenges. 💻 Problems Solved: 1️⃣ FizzBuzz – A fun way to practice modular arithmetic and condition prioritization. 2️⃣ Reverse String – Implemented using the two-pointer approach for an in-place reversal. 💡 Key Takeaways: FizzBuzz reinforces thinking through branching logic. The two-pointer method is efficient for array and string manipulation. Small problems like these build the foundation for complex algorithms. 🔗 Check out my implementations here: https://lnkd.in/gxs9yaen #100DaysOfCode #DSA #LeetCode #JavaScript #CodingJourney #ProblemSolving #LearningInPublic
Practiced FizzBuzz and Reverse String on LeetCode
More Relevant Posts
-
🌟 Day 22 of #100DaysOfDSA Today, I solved two interesting problems: 1️⃣ Reverse a Linked List Reversed a singly linked list by iteratively changing the node pointers. Time Complexity: O(n) Space Complexity: O(1) 2️⃣ Move Zeroes Rearranged all zeroes in an array to the end while maintaining the order of non-zero elements — done in-place with linear time. Time Complexity: O(n) Space Complexity: O(1) Both problems were great practice for improving logical thinking and working efficiently with pointers and arrays. https://lnkd.in/gt7VYQ_E #100DaysOfCode #DSA #JavaScript #CodingJourney #LearningInPublic #LeetCode
To view or add a comment, sign in
-
📘 Day 175 of #200DaysOfCode Today, I explored how to count the number of properties in a JavaScript object — a small but meaningful step toward understanding how objects truly work under the hood. 🧠 Key Concepts Practiced • Working with objects • Looping through keys using for...in • Using hasOwnProperty() to avoid inherited keys • Returning calculated output 🌍 Real-World Uses ✅ Validating form inputs ✅ Checking JSON response structures ✅ Data integrity checks ✅ Object analysis in APIs 🔎 Learning takeaway: Even the simplest operations help you develop a deeper understanding of core JavaScript behavior. Mastering the fundamentals builds confidence for tackling complex problems later. #JavaScript #Day175 #175DaysOfCode #ProblemSolving #CodingChallenge #WebDevelopment #LogicBuilding #BackToBasics #LearnInPublic #DeveloperJourney #CodingMindset
To view or add a comment, sign in
-
-
DSA Practice — Day 10 Solved the “Merge Sorted Array” problem on LeetCode 🧩 At first glance, it looked simple — just merge and sort. But when I started optimizing, it turned into an interesting challenge. 🧠 My Approaches: 1️⃣ Brute Force: Directly add all elements into one array and sort. (Simple, but inefficient ) 2️⃣ Two Pointer + Extra Space: Created a copy of nums1 and merged both arrays efficiently. ➤ Time Complexity: O(m + n) ➤ Space Complexity: O(n) 3️⃣ Optimized In-Place Approach: Used two pointers starting from the end of both arrays — merging in reverse order without extra space. ➤ Time Complexity: O(m + n) ➤ Space Complexity: O(1) 💡 Lesson: The best solution often hides behind simple logic — you just have to look from the right direction. #DSA #LeetCode #ProblemSolving #JavaScript #LearningInPublic #CodingJourney #BackendDeveloper #100DaysOfCode
To view or add a comment, sign in
-
-
Day 23/90 – 90 Days DSA Challenge Today I practiced another classic recursion problem — Sum of first N natural numbers using recursion 💡 🧠 Concept Recap: Recursion is when a function calls itself with a smaller input until it reaches a base condition. It’s like peeling an onion layer by layer — until you reach the core 🧅 ⚙️ Problem Statement: 👉 Write a function sum(n) that calculates the sum of the first n natural numbers. 🧩 Example: Input: 5 Process: 5 + 4 + 3 + 2 + 1 = 15 Output: 15 Time Complexity: O(n) 💾 Space Complexity: O(n) (due to call stack) ✨ Key takeaway: Recursion helps break down complex problems into smaller, simpler ones — it’s elegant, powerful, and mind-opening once you get the hang of it! #Day23 #DSA #Recursion #JavaScript #CodingChallenge #MechCode #LearningInPublic #FrontendDeveloper #CodeEveryday
To view or add a comment, sign in
-
-
Day 8 of #100DaysOfNeetCode | #NeetCode150 Today I solved the Valid Anagram problem — a fundamental string question that focuses on frequency counting and efficient comparison. 1. Valid Anagram -> Goal: Determine if two strings are anagrams, meaning one string can be formed by rearranging the letters of the other. -> Brute Force: Sort both strings and compare them directly. Simple but has a time complexity of O(n log n+ m long m). -> Optimized: Use two hash maps to count the frequency of each character in both strings, then compare their counts. If every character frequency matches, the strings are anagrams. Key idea: Counting frequencies eliminates the need for sorting, reducing time complexity. Example: s = "racecar", t = "carrace" → Output: true s = "hello", t = "bello" → Output: false Time Complexity: O(n), Space: O(1) (constant alphabet size) Takeaway: Hash maps are a powerful tool for counting and comparing elements efficiently, a concept that extends to many string and array problems. #Day8 #JavaScript #LeetCode #NeetCode150 #DSA #ProblemSolving #100DaysOfNeetCode #CodingJourney
To view or add a comment, sign in
-
-
Start free on CSX and practice as you read: https://lnkd.in/eFtB-g27 In JavaScript, data types tell your code how to treat a value. Primitives are single values like text, numbers, and true/false. Composites group values together as labeled objects or ordered lists. Knowing the difference helps your conditions, loops, and functions behave predictably. Practice the data types lesson on CSX. Get instant feedback and beginner-friendly exercises. Follow for more tips.💻 ✨ #javascript #coding #webdevelopment #csx #datatypes #objects #arrays
To view or add a comment, sign in
-
🚀 Day 82 of #100DaysOfCode Today I learned to create an object literal in JavaScript to model a Thread/Twitter post. By organizing properties like username, content, likes, reposts, and tags into a single object, it becomes easy to manage and update social media data! Example: const post = { username: "coder123", content: "Excited to share my #100DaysOfCode progress!", likes: 120, reposts: 15, tags: ["coding", "javascript", "learning"] }; Object literals make real-world data handling simple and powerful in code. #JavaScript #ObjectLiterals #SocialMedia #Coding #100DaysOfCode
To view or add a comment, sign in
-
-
Day 319: Learnt JavaScript objects and arrays: property access, shallow vs deep copying with structuredClone(), best iteration techniques using for...of, avoiding pitfalls of for...in, destructuring with defaults, and mutating vs non-mutating array methods. Key skills for writing safe, efficient, and maintainable JS code! #dailylearning Masai #Masaiverse
To view or add a comment, sign in
-
-
It’s not always the complex algorithms that break systems , sometimes it’s a single misplaced string. The smallest things in code often make the biggest impact. That’s the difference between something that works and something that’s well-engineered. I wrote a short blog about one of those small but important habits avoiding “magic strings” in code. 🪄 “The Problem with Magic Strings - and How to Avoid Them” Read it here 👉 https://lnkd.in/gQUBC3TS #CleanCode #SoftwareEngineering #JavaScript #CodingBestPractices #DeveloperMindset #Maintainability
To view or add a comment, sign in
-
Today, I solved an interesting LeetCode problem called “Max Sum of a Pair With Equal Sum of Digits(https://lnkd.in/gfE37qjM)". It looks simple — until you realize it’s actually two problems cleverly disguised as one. Let’s break it down: Problem 1 — Compute the Digit Sum For each number, we first need its digit sum — a classic number manipulation subproblem. 51 → 5 + 1 = 6 42 → 4 + 2 = 6 This step groups numbers by a common mathematical property — their digit sum. Problem 2 — Find the Maximum Pair Sum in Each Group Once we group numbers by their digit sum, the next challenge is to find two numbers with the same sum of digits that produce the largest total. This now becomes a hash map optimization problem: Use a map to store the largest number seen for each digit sum. For every new number, check if we already have one with the same digit sum. If yes → compute the potential pair sum → update the maximum. Approach Summary Digit Sum Calculation: O(logn) per number Hash Map Lookup: O(1) per operation Overall Time: O(n), efficient and clean Here is the solution Below #LeetCode #JavaScript #Coding
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