LeetCode Challenge: Plus One & Single Number Problems

🚀 Day 1 of My DSA Journey – Solved LeetCode Problem #66 (Plus One) 💡 Today I worked on the “Plus One” and "Single Number " problem from LeetCode using JavaScript. 🔢 1.Problem Summary: Given an array of digits representing a number, add one to the number and return the result as an array. 💭 What I Learned: • Handling edge cases (especially when digit = 9) • Understanding carry forward logic • Thinking from Right → Left (LSD to MSD) • Why simple problems test core fundamentals The interesting part? 🤯 When a digit is 9, we convert it to 0 and carry 1 to the previous digit. If all digits are 9 → we add 1 at the beginning using unshift(). Small problem. Big learning. Strong fundamentals. 💪 🔢 Problem #136 – Single Number Summary: Given an array where every number appears twice except one, find the number that appears only once. 💡 Key Learning: • XOR (^) cancels duplicates automatically • Only the unique number remains • Time Complexity = O(n), Space Complexity = O(1) ✅ • Pattern recognition is 🔑: “Duplicates cancel → Unique remains” 🎯 Goal: Solve 5 problems daily Master Data Structures & Algorithms Become interview ready for product-based companies Consistency > Motivation 🔥 #DSA #LeetCode #JavaScript #ProblemSolving #SoftwareEngineer #100DaysOfCode

  • graphical user interface

To view or add a comment, sign in

Explore content categories