Find the Single Non-Duplicate Element in a Sorted Array 👉 Day 20 / Day 93 👈 🔥 challenge: Find the single non-duplicate element in a sorted array where every other element appears exactly twice. 🔥Instead of using extra space or a linear scan, we use a Binary Search approach to achieve O(log n) time complexity and O(1) space. 🔥 #JavaScript #CodingInterview #DSA #LeetCode #ProblemSolving #BinarySearch #FrontendEngineer #100DaysOfCode
How to find a single non-duplicate in a sorted array using Binary Search
More Relevant Posts
-
Today I practiced one of the classic algorithm problems — implementing the atoi (string to integer) function manually in JavaScript. This problem helps understand: String parsing Handling whitespace and signs Managing integer overflow and boundaries (INT_MAX, INT_MIN) Character to digit conversion using charCodeAt() Here’s a short summary of what my code does: Skips leading spaces Checks for '+' or '-' sign Converts valid numeric characters into an integer Stops at the first invalid character Returns result within 32-bit integer range #JavaScript #CodingChallenge #LeetCode #WebDevelopment #ProblemSolving #LearningJourney
To view or add a comment, sign in
-
-
🌟 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
-
Peak Index in a Mountain ⛰️ Array | Binary Search 👉 Day 18 / Day 93 👈 Key Takeaways: 👉 Binary Search isn’t just for sorted arrays — it can find peaks too! 👉 Compare arr[m] and arr[m + 1] to decide direction. 👉 When l === r, you’ve found the peak index. 👉 Time Complexity: O(log n) 👉 Space Complexity: O(1) #JavaScript #BinarySearch #CodingInterview #LeetCode #ProblemSolving #SoftwareEngineering #TechInterview #FrontEndDeveloper #WebDevelopment #CodingChallenge #AngularDeveloper
To view or add a comment, sign in
-
-
💡 JavaScript LeetCode Challenge — Day 19: Longest Common Prefix 🚀 Today’s Challenge: Find the longest common prefix among an array of strings. 🧩 Problem Example: Input: ["flower", "flow", "flight"] Output: "fl" If no common prefix exists, return "". 💭 Key Takeaways: Improved understanding of string manipulation in JavaScript Practiced prefix trimming logic using indexOf() and slice() Every solved problem = better problem-solving muscle 💪 📈 #Day19 #JavaScript #LeetCode #CodingChallenge #100DaysOfCode #WebDevelopment #ProblemSolving #LearningInPublic #CodeNewbie
To view or add a comment, sign in
-
-
DSA Practice — Day 7 Solved the “Remove Duplicates from Sorted Array” problem on LeetCode. 🧩 Approach: • First, understood the problem statement clearly. • Analyzed the given examples and patterns. • Performed a dry run on paper to visualize the algorithm. • Implemented a pointer-based approach to remove duplicates efficiently. “Clarity before code — that’s how you build problem-solving discipline.” #DSA #LeetCode #ProblemSolving #JavaScript #LearningInPublic #CodingJourney #BackendDeveloper
To view or add a comment, sign in
-
-
DSA Practice — Day 14 Solved the “Longest Common Prefix” problem today — a classic string-processing question. 🧠 Problem: Given an array of strings, find the longest common prefix among them. If no common prefix exists, return an empty string. At first, I tried multiple pointer-based approaches but kept failing because of tricky edge cases. So I looked at the optimized solution, studied it properly, wrote it down in my notebook, and visualized how the prefix shrinks with each comparison. 🔍 Optimized Logic (Shrinking Prefix Approach) Start with the first string as the initial prefix. Compare it with each string in the list. While the current string doesn’t start with that prefix, keep reducing the prefix length. If prefix becomes empty → return "". Simple, intuitive, and efficient. “Logic becomes simple when you truly understand what the algorithm is doing.” #DSA #Day15 #LeetCode #CodingJourney #ProblemSolving #JavaScript #LearningInPublic #BackendDeveloper
To view or add a comment, sign in
-
-
🚀 𝗗𝗮𝘆 𝟭𝟯 𝗼𝗻 𝗟𝗲𝗲𝘁𝗖𝗼𝗱𝗲 Today’s focus was all about mastering sorting and maps in JavaScript two tools that keep showing up everywhere in problem-solving. 🧠 𝗜 𝘀𝗼𝗹𝘃𝗲𝗱: 🔹 344. Reverse String 🔹 977. Squares of a Sorted Array 🔹 242. Valid Anagram 🔹 49. Group Anagrams 💡 𝗞𝗲𝘆 𝘁𝗮𝗸𝗲𝗮𝘄𝗮𝘆: Understanding how sort() and Map() work under the hood makes problems around strings and arrays much easier to tackle. Especially “Group Anagrams” a perfect test for logic and pattern recognition 🧩 #LeetCode #JavaScript #LearnInPublic #BuildInPublic #ProblemSolving #100DaysOfCode #WebDevJourney
To view or add a comment, sign in
-
-
🧩 Day 41 | Classes & Default Parameters Today’s focus was on Classes & Default Parameters — how structure, encapsulation, and flexibility elevate JavaScript’s power. ✨ Key Insight: Classes help organize code; default parameters make it smarter and reusable. 🔗 GitHub: https://lnkd.in/dtdU9-zZ #WebDevelopment #JavaScript #CodingJourney #OOP
To view or add a comment, sign in
-
-
Count the Number of Digits - JavaScript Logic Simplified 👉 Day 24 / Day 93👈 👉 Find how many digits a number has — without converting it to a string? 1️⃣ Handle 0 as a special case — it has 1 digit. 2️⃣ Use Math.abs() to support negative numbers. 3️⃣ Repeatedly divide the number by 10 until it becomes 0, increasing the counter each time. 💡 Example: 👉 23453 → 2345 → 234 → 23 → 2 → 0 ✅ Total digits = 5 #JavaScript #CodingTips #WebDevelopment #FrontendDeveloper #LearnToCode #ProgrammingLogic #CleanCode #ProblemSolving #100DaysOfCode #TechCommunity #CodeNewbie #Algorithms
To view or add a comment, sign in
-
-
Exploring Brimstone, a new JavaScript engine written in Rust. This project supports almost all of the ECMAScript language and offers a bytecode VM, compacting garbage collector, and custom RegExp engine. Use case: Enhanced performance in web apps by leveraging Rust's efficiency. Another use case: Server-side JavaScript execution with improved memory management. Contribute and learn more: https://lnkd.in/g4GrgeBA #JavaScript #Rust #ECMAScript #SoftwareDevelopment #OpenSource
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