LogIn
I don't have account.
Sponsored -53%
Zebronics #1 Best Seller

ZEBRONICS Blanc Slim Wireless Mouse — Rechargeable, BT + 2.4GHz (Black)

Up to 1600 DPI · Silent clicks · 63g · Multicolor LED

★★★★★ 4.0 (9,512) 5K+ bought last month
₹376 M.R.P. ₹799Save ₹423
Buy Now
Adℹ

Remove Duplicates from Sorted Array (In-Place)

HackFury
45 Views
Amazon Pay offer
Adℹ

Given an integer array sorted in non-decreasing order, remove the duplicates in-place so that each unique element appears only once. The relative order of elements must be preserved.

  • Return the number of unique elements k.

  • The first k elements of the array should store the unique values.

  • Values beyond the first k positions don’t matter.

Example 1

Input: nums = [1,1,2]
  Output: 2, nums = [1,2,_]
  Explanation: Unique numbers are [1,2]. Return length 2.

Example 2

Input: nums = [0,0,1,1,1,2,2,3,3,4]
  Output: 5, nums = [0,1,2,3,4,_,_,_,_,_]
  Explanation: Unique numbers are [0,1,2,3,4].

Constraints

  • 1 <= nums.length <= 3 * 10^4

  • -100 <= nums[i] <= 100

  • nums is sorted in non-decreasing order

Brute Force Idea

Since the array is sorted, all duplicates appear next to each other.

Steps:

  • Use a temporary data structure (like Set) to store only unique elements.

  • Iterate over the original array and add elements to the Set.

  • Copy the unique elements back to the original array.

  • Return the size of the Set as the number of unique elements.

import java.util.*;

class RemoveDuplicatesBruteForce {
    public int removeDuplicates(int[] nums) {
        // LinkedHashSet preserves insertion order
        Set<Integer> set = new LinkedHashSet<>();
        for (int num : nums) {
            set.add(num);
        }
        int i = 0;
        for (int val : set) {
            nums[i++] = val;
        }
        return set.size(); // number of unique elements
    }
    public static void main(String[] args) {
        RemoveDuplicatesBruteForce sol = new RemoveDuplicatesBruteForce();
        int[] nums = {0,0,1,1,1,2,2,3,3,4};
        int k = sol.removeDuplicates(nums);
        System.out.println("Unique count: " + k);
        for (int i = 0; i < k; i++) {
            System.out.print(nums[i] + " ");
        }
    }
}
Unique count: 5
  0 1 2 3 4

Complexity Analysis

  • Time Complexity : O(n), Iterating + Set insertions
  • Space Complexity : O(n), Extra storage for unique elements

Brute Force In-Place Idea

  • Iterate through the array starting from index 1.

  • If the current element is equal to the previous element (nums[i] == nums[i-1]), it is a duplicate.

  • Shift all elements to the left to overwrite the duplicate.

  • Reduce the size of the array (k--) and recheck the current index (i--).

  • Continue until the end of the array.

This method does not use extra memory, but it is very inefficient for large arrays because of repeated shifting.

class RemoveDuplicatesShift {

    public int removeDuplicates(int[] nums) {
        int n = nums.length;
        int k = n; // current effective length of array
        for (int i = 1; i < k; i++) {
            if (nums[i] == nums[i - 1]) {
                for (int j = i; j < k - 1; j++) {
                    nums[j] = nums[j + 1];
                }
                k--; // decrease effective size
                i--; // recheck current index after shifting
            }
        }
        return k;
    }
    public static void main(String[] args) {
        RemoveDuplicatesShift sol = new RemoveDuplicatesShift();
        int[] nums = {0,0,1,1,1,2,2,3,3,4};
        int k = sol.removeDuplicates(nums);
        System.out.println("Unique count: " + k);
        for (int i = 0; i < k; i++) {
            System.out.print(nums[i] + " ");
        }
    }
}
Unique count: 5
  0 1 2 3 4

Complexity Analysis

  • Time Complexity : O(n²), Nested loops for shifting duplicates
  • Space Complexity :O(1), No extra space used

Two Pointer Technique

Removing duplicates from a sorted array is a common problem in coding interviews and algorithm practice. If the array is sorted, all duplicates appear consecutively. This allows us to solve the problem efficiently using the Two Pointer Technique in one pass, without using extra space.

  • Since the array is sorted, duplicates are always adjacent.

  • We can use two pointers to efficiently remove duplicates:

  • Pointer i (slow) -> Keeps track of the last unique element.

  • Pointer j (fast) -> Scans through the array.

Step-by-Step Algorithm

  • Initialize i = 0 :- the first element is always unique.

  • Iterate j from 1 to the end of the array:

    • If nums[j] != nums[i], it means nums[j] is a new unique element.

    • Increment i by 1.

    • Copy nums[j] into nums[i].

  • After the loop, i + 1 gives the number of unique elements in the array.

Why Two Pointer Technique Works

  • Sorted arrays ensure duplicates are together.

  • The slow pointer (i) ensures we only keep unique elements at the start.

  • The fast pointer (j) scans for new unique elements.

  • Time Complexity: O(n) :- One pass through the array.

  • Space Complexity: O(1) :- No extra memory used.

This is the optimal solution for in-place duplicate removal in a sorted array.

class RemoveDuplicates {
    public int removeDuplicates(int[] nums) {
        if (nums.length == 0) return 0; // edge case: empty array
        int i = 0; // slow pointer - tracks last unique element
        for (int j = 1; j < nums.length; j++) { // fast pointer - scans array
            if (nums[j] != nums[i]) {
                i++;            // move slow pointer forward
                nums[i] = nums[j]; // update unique element
            }
        }
        return i + 1; // length of unique elements
    }
    public static void main(String[] args) {
        RemoveDuplicates sol = new RemoveDuplicates();
        int[] nums1 = {1, 1, 2};
        int k1 = sol.removeDuplicates(nums1);
        System.out.println("Unique count: " + k1);
        for (int i = 0; i < k1; i++) System.out.print(nums1[i] + " ");
        System.out.println();
        int[] nums2 = {0,0,1,1,1,2,2,3,3,4};
        int k2 = sol.removeDuplicates(nums2);
        System.out.println("Unique count: " + k2);
        for (int i = 0; i < k2; i++) System.out.print(nums2[i] + " ");
    }
}
Unique count: 2
  1 2
  Unique count: 5
  0 1 2 3 4

Complexity Comparison of Approaches

Approach Time Complexity Space Complexity In-place Notes
Brute Force (extra Set) O(n) O(n) No Simple, but not truly in-place
Brute Force (Shift duplicates) O(n²) O(1) Yes Works, but inefficient
Two-Pointer (Optimal) O(n) O(1) Yes Best choice for interviews
Responses (0)

Write a response

CommentHide Comments

No Comments yet.

"},"4":{"id":4,"name":"ZEBRONICS Blanc mouse ad","otherData":"{}","contentFormat":2,"content":"
Sponsored -53%
Zebronics #1 Best Seller

ZEBRONICS Blanc Slim Wireless Mouse — Rechargeable, BT + 2.4GHz (Black)

Up to 1600 DPI · Silent clicks · 63g · Multicolor LED

★★★★★ 4.0 (9,512) 5K+ bought last month
₹376 M.R.P. ₹799Save ₹423
Buy Now
"},"2":{"id":2,"name":"Crousal Ads","otherData":"{}","contentFormat":2,"content":"
Sponsored -34%
iQOO Amazon's Choice

iQOO Z10 Lite 5G — Cyber Green, 4GB RAM, 128GB Storage

Dimensity 6300 · 50MP Sony AI Camera · 6000 mAh · IP64

★★★★★ 4.0 (2,052) 500+ bought last month
₹18,997 M.R.P. ₹28,999Save ₹10,002
Buy Now
"},"1":{"id":1,"name":"Banner Ads","otherData":"{}","contentFormat":2,"content":"\n
\n \n \n \"Amazon\n \n
"}}},"blogDetails":{"isWriter":false,"likes":0,"isLikedByUser":false,"tagIds":[17,62,133,169],"tags":[{"id":17,"name":"Array","maskingName":"array","isFeatured":true},{"id":62,"name":"Sorting","maskingName":"sorting","isFeatured":true},{"id":133,"name":"Coding Problems","maskingName":"coding-problems","isFeatured":true},{"id":169,"name":"Two Pointes","maskingName":"two-pointers","isFeatured":true}],"comments":[],"bookmark":{"isBookmarked":false,"count":0},"author":{"userId":"MjlfNF84LVs0XTJuLXRDX0FOZ2VfX0l0","name":"HackFury"},"viewCount":44,"showBannerImage":false,"seoTags":null,"content":"

Given an integer array sorted in non-decreasing order, remove the duplicates in-place so that each unique element appears only once. The relative order of elements must be preserved.

\n\n

Example 1

\n
Input: nums = [1,1,2]\n  Output: 2, nums = [1,2,_]\n  Explanation: Unique numbers are [1,2]. Return length 2.\n
\n

Example 2

\n
Input: nums = [0,0,1,1,1,2,2,3,3,4]\n  Output: 5, nums = [0,1,2,3,4,_,_,_,_,_]\n  Explanation: Unique numbers are [0,1,2,3,4].\n
\n

Constraints

\n\n

Brute Force Idea

\n

Since the array is sorted, all duplicates appear next to each other.

\n

Steps:

\n\n
import java.util.*;\n\nclass RemoveDuplicatesBruteForce {\n    public int removeDuplicates(int[] nums) {\n        // LinkedHashSet preserves insertion order\n        Set<Integer> set = new LinkedHashSet<>();\n        for (int num : nums) {\n            set.add(num);\n        }\n        int i = 0;\n        for (int val : set) {\n            nums[i++] = val;\n        }\n        return set.size(); // number of unique elements\n    }\n    public static void main(String[] args) {\n        RemoveDuplicatesBruteForce sol = new RemoveDuplicatesBruteForce();\n        int[] nums = {0,0,1,1,1,2,2,3,3,4};\n        int k = sol.removeDuplicates(nums);\n        System.out.println(\"Unique count: \" + k);\n        for (int i = 0; i < k; i++) {\n            System.out.print(nums[i] + \" \");\n        }\n    }\n}\n
\n
Unique count: 5\n  0 1 2 3 4\n
\n

Complexity Analysis

\n\n

Brute Force In-Place Idea

\n\n
\n

This method does not use extra memory, but it is very inefficient for large arrays because of repeated shifting.

\n
\n
class RemoveDuplicatesShift {\n\n    public int removeDuplicates(int[] nums) {\n        int n = nums.length;\n        int k = n; // current effective length of array\n        for (int i = 1; i < k; i++) {\n            if (nums[i] == nums[i - 1]) {\n                for (int j = i; j < k - 1; j++) {\n                    nums[j] = nums[j + 1];\n                }\n                k--; // decrease effective size\n                i--; // recheck current index after shifting\n            }\n        }\n        return k;\n    }\n    public static void main(String[] args) {\n        RemoveDuplicatesShift sol = new RemoveDuplicatesShift();\n        int[] nums = {0,0,1,1,1,2,2,3,3,4};\n        int k = sol.removeDuplicates(nums);\n        System.out.println(\"Unique count: \" + k);\n        for (int i = 0; i < k; i++) {\n            System.out.print(nums[i] + \" \");\n        }\n    }\n}\n
\n
Unique count: 5\n  0 1 2 3 4\n
\n

Complexity Analysis

\n\n

Two Pointer Technique

\n

Removing duplicates from a sorted array is a common problem in coding interviews and algorithm practice. If the array is sorted, all duplicates appear consecutively. This allows us to solve the problem efficiently using the Two Pointer Technique in one pass, without using extra space.

\n\n

Step-by-Step Algorithm

\n\n

Why Two Pointer Technique Works

\n\n

This is the optimal solution for in-place duplicate removal in a sorted array.

\n
class RemoveDuplicates {\n    public int removeDuplicates(int[] nums) {\n        if (nums.length == 0) return 0; // edge case: empty array\n        int i = 0; // slow pointer - tracks last unique element\n        for (int j = 1; j < nums.length; j++) { // fast pointer - scans array\n            if (nums[j] != nums[i]) {\n                i++;            // move slow pointer forward\n                nums[i] = nums[j]; // update unique element\n            }\n        }\n        return i + 1; // length of unique elements\n    }\n    public static void main(String[] args) {\n        RemoveDuplicates sol = new RemoveDuplicates();\n        int[] nums1 = {1, 1, 2};\n        int k1 = sol.removeDuplicates(nums1);\n        System.out.println(\"Unique count: \" + k1);\n        for (int i = 0; i < k1; i++) System.out.print(nums1[i] + \" \");\n        System.out.println();\n        int[] nums2 = {0,0,1,1,1,2,2,3,3,4};\n        int k2 = sol.removeDuplicates(nums2);\n        System.out.println(\"Unique count: \" + k2);\n        for (int i = 0; i < k2; i++) System.out.print(nums2[i] + \" \");\n    }\n}\n
\n
Unique count: 2\n  1 2\n  Unique count: 5\n  0 1 2 3 4\n\n
\n

Complexity Comparison of Approaches

\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
ApproachTime ComplexitySpace ComplexityIn-placeNotes
Brute Force (extra Set)O(n)O(n)NoSimple, but not truly in-place
Brute Force (Shift duplicates)O(n²)O(1)YesWorks, but inefficient
Two-Pointer (Optimal)O(n)O(1)YesBest choice for interviews
","categoryId":177,"subCategoryId":177,"contentFormat":5,"blogId":22,"userId":"MjlfNF84LVs0XTJuLXRDX0FOZ2VfX0l0","title":"Remove Duplicates from Sorted Array (In-Place)","url":"remove-duplicates-from-sorted-array-in-place","bannerImage":"","seoDescription":"","generatedOn":"2025-10-03T17:52:59","updatedOn":"2025-10-03T17:52:59"},"popularContents":[{"id":130,"title":"Rippling SDE-2 Interview Experience (4+ Years Experience) | Offer Received | Coding, LLD & System Design","url":"rippling-sde-2-interview-experience-4-years-experience-offer-received-coding-lld-system-design","description":null,"seoDescription":"Detailed Rippling SDE-2 interview experience with complete 5 rounds, coding questions, rules engine design, system design and preparation tips.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4255825Z","viewCount":0},{"id":35,"title":"Cursor vs Copilot : Which AI Coding Assistant Wins in 2025?","url":"cursor-vs-copilot-which-ai-coding-assistant-truly-wins-in-2025","description":null,"seoDescription":"Compare Cursor vs GitHub Copilot on speed, context awareness, multi-file support, pricing and code quality to choose the best AI coding assistant for developers","contentType":5,"generatedOn":"2026-10-14T22:55:44.4255745Z","viewCount":0},{"id":168,"title":"Amazon SDE-2 Interview Experience (3 Years Experience)","url":"amazon-sde-2-interview-experience-3-years-experience","description":null,"seoDescription":" Read a real Amazon SDE-2 interview experience covering the online assessment, coding rounds, object-oriented design, leadership principles and system design.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4255865Z","viewCount":0},{"id":163,"title":"Top 50 SQL Interview Questions and Answers (Beginner to Intermediate)","url":"top-sql-interview-questions-and-answers-beginner-to-intermediate","description":null,"seoDescription":"Top 50 SQL Interview Questions and Answers (Beginner to Intermediate). Top SQL Interview Questions for fresher. Frequently asked SQL interview questions with answers","contentType":2,"generatedOn":"2026-10-14T22:55:44.4249726Z","viewCount":0},{"id":122,"title":"Zepto SDE-1 Interview Experience (Backend Developer) : Real DSA, LLD, Chess Game Design","url":"zepto-sde-1-interview-experience-backend-developer-real-dsa-lld-chess-game-design","description":null,"seoDescription":" Zepto SDE-1 Backend Interview Experience covering DSA, Dynamic Programming, LLD, API Design, DB Schema, OOP & Product Company Rounds.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4255766Z","viewCount":0},{"id":213,"title":"Amazon SDE II Interview Experience (Bangalore, Selected) ~ Aug 2026","url":"amazon-sde-ii-interview-experience-bangalore-selected-aug-2026","description":null,"seoDescription":"Amazon SDE II interview experience from Bangalore covering 4 rounds, DSA, LLD, system design, Leadership Principles, coding questions and selection.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4255899Z","viewCount":0},{"id":173,"title":"Uber SDE-2 Interview Experience : LLD, HLD, DSA & Hiring Manager Round","url":"uber-sde-2-interview-experience-lld-hld-dsa-hiring-manager-round","description":null,"seoDescription":"Read a real Uber SDE-2 interview experience covering DSA, low-level design, high-level system design, behavioral rounds, hiring freeze and key takeaways.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4255883Z","viewCount":0},{"id":34,"title":"System Design Deep Dive: 25 Essential Interview Questions","url":"system-design-deep-dive-25-essential-interview-questions","description":null,"seoDescription":"","contentType":5,"generatedOn":"2026-10-14T22:55:44.4255696Z","viewCount":0},{"id":167,"title":"Meesho SDE-1 Online Assessment Interview Experience (Remote) - Rejected","url":"meesho-sde-1-online-assessment-interview-experience-remote-rejected","description":null,"seoDescription":"Read a real Meesho SDE-1 online assessment experience with coding questions, DSA topics, solutions, difficulty level, preparation tips and interview insights.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4255842Z","viewCount":0},{"id":166,"title":"System Design Interview – BIGGEST Mistakes to Avoid","url":"system-design-interview-biggest-mistakes-to-avoid","description":null,"seoDescription":"Learn the biggest mistakes to avoid in a system design interview, from unclear requirements to poor trade-off analysis. Includes real-world cases, advanced insights and examples to help you ace your next system design interview.","contentType":2,"generatedOn":"2026-10-14T22:55:44.4249778Z","viewCount":0}],"latestContents":[{"id":219,"title":"6 Tools That Made My Life Easier as a Software Engineer","url":"6-tools-that-made-my-life-easier-as-a-software-engineer","description":null,"seoDescription":"The 6 developer tools I use daily as a software engineer: Git, VS Code, Docker, Postman, Chrome DevTools, and AI assistants, with real tips, mistakes, and trade","contentType":5,"generatedOn":"2026-10-14T22:55:44.424381Z","viewCount":0},{"id":218,"title":"When Should a Business Use Multiple AI Agents Instead of One?","url":"when-should-a-business-use-multiple-ai-agents-instead-of-one","description":null,"seoDescription":"Single agent or multi-agent AI? Learn the 4 signals that justify splitting agents by knowledge, permissions, and risk, plus routing and handoff tips.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4243861Z","viewCount":0},{"id":216,"title":"AI in Clinical Trials Market Estimated to Experience a Hike in Growth by 2035","url":"ai-in-clinical-trials-market-estimated-to-experience-a-hike-in-growth-by-2035","description":null,"seoDescription":"The exclusive information about market dynamics serves as a valuable guide to predict economic scenarios and initiatives taken to enhance future growth. Our mar","contentType":5,"generatedOn":"2026-10-14T22:55:44.4243925Z","viewCount":0},{"id":217,"title":"AI in Clinical Trials Market Estimated to Experience a Hike in Growth by 2035","url":"ai-in-clinical-trials-market-estimated-to-experience-a-hike-in-growth-by-2035","description":null,"seoDescription":"The exclusive information about market dynamics serves as a valuable guide to predict economic scenarios and initiatives taken to enhance future growth. Our mar","contentType":5,"generatedOn":"2026-10-14T22:55:44.4243937Z","viewCount":0},{"id":215,"title":"What Happens When an AI Agent Doesn't Know the Answer?","url":"what-happens-when-an-ai-agent-doesnt-know-the-answer","description":null,"seoDescription":"Most AI agents fail quietly. They guess instead of saying \"I don't know.\" Here's how to design better fallback and human-handoff behavior.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4243949Z","viewCount":0},{"id":214,"title":"Greedy Algorithms Explained: How They Work, When They Fail and How to Use Them","url":"greedy-algorithms-explained-how-they-work-when-they-fail-and-how-to-use-them","description":null,"seoDescription":"Learn greedy algorithms step by step with C# code Dijkstra, Huffman coding, knapsack and MSTs plus when greedy fails and how to prove it's correct","contentType":5,"generatedOn":"2026-10-14T22:55:44.4243965Z","viewCount":0},{"id":213,"title":"Amazon SDE II Interview Experience (Bangalore, Selected) ~ Aug 2026","url":"amazon-sde-ii-interview-experience-bangalore-selected-aug-2026","description":null,"seoDescription":"Amazon SDE II interview experience from Bangalore covering 4 rounds, DSA, LLD, system design, Leadership Principles, coding questions and selection.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4243977Z","viewCount":0},{"id":212,"title":"How to Get 10x Better AI Answers Without Writing Better Prompts : 10 Proven Techniques","url":"how-to-get-10x-better-ai-answers-without-writing-better-prompts-10-proven-techniques","description":null,"seoDescription":"Get better AI answers without complex prompts. Learn 10 practical techniques using context, examples, tools, feedback, and verification.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4243989Z","viewCount":0},{"id":211,"title":"I Interviewed for a Microsoft SDE I Role. Here's Everything That Happened.","url":"i-interviewed-for-a-microsoft-sde-i-role-heres-everything-that-happened","description":null,"seoDescription":"My real Microsoft SDE I interview experience, all 4 rounds, the exact DSA problems with fully tested solutions, the WhatsApp system design round","contentType":5,"generatedOn":"2026-10-14T22:55:44.4244001Z","viewCount":0},{"id":140,"title":"PolicyBazaar Software Development Engineer (SDE) Interview Experience | DSA, Core CS & System Design","url":"policybazaar-software-development-engineer-sde-interview-experience-dsa-core-cs-system-design","description":null,"seoDescription":"Detailed PolicyBazaar SDE interview experience covering 3 rounds: DSA coding, core CS assessment and system design with key learnings and insights.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4244015Z","viewCount":0}],"relatedContents":[{"id":207,"title":"How to Find the Right View of a Binary Tree","url":"right-view-of-a-binary-tree","description":null,"seoDescription":"Learn how to find the right view of a binary tree using DFS and BFS, with examples, code, complexity analysis and coding interview tips.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4290249Z","viewCount":0},{"id":206,"title":"Left View of a Binary Tree: DFS and BFS Approaches Explained","url":"left-view-of-a-binary-tree","description":null,"seoDescription":"Learn how to find the left view of a binary tree using DFS and BFS, with examples, code, complexity analysis, common mistakes and interview tips.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4290292Z","viewCount":0},{"id":205,"title":"Top View of a Binary Tree Using BFS and DFS | Complete Guide","url":"top-view-of-a-binary-tree","description":null,"seoDescription":"Learn how to find the top view of a binary tree using DFS and BFS with step-by-step explanations, examples, code, complexity analysis and interview insights.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4290308Z","viewCount":0},{"id":201,"title":"Bottom View of a Binary Tree: DFS vs BFS Approach","url":"bottom-view-of-a-binary-tree-dfs-vs-bfs-approach","description":null,"seoDescription":"Learn to find the bottom view of a binary tree using horizontal distance. Compares a buggy DFS attempt, a fixed DFS and the optimal BFS solution in Java.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4290351Z","viewCount":0},{"id":200,"title":" Longest Playlist With No Repeated Songs : Brute Force to Optimal","url":"longest-playlist-with-no-repeated-songs-brute-force-to-optimal","description":null,"seoDescription":"Find the longest playlist with no repeated songs using brute force, HashSet, and HashMap sliding window techniques, with Java code and dry runs.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4290367Z","viewCount":0},{"id":90,"title":"Contain Virus : Deep, Intuitive & Fully Explained Guide","url":"contain-virus-deep-intuitive-fully-explained-guide","description":null,"seoDescription":"Contain Virus problem explained with DFS + greedy approach, step-by-step simulation, examples and optimized solutions for coding interviews.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4290385Z","viewCount":0},{"id":37,"title":"Find the repeating and missing numbers","url":"find-the-repeating-and-missing-numbers","description":null,"seoDescription":"Find the repeating and missing numbers in an array from 1..n using brute force, hashmap, math and XOR, step-by-step explained with real-world use cases.","contentType":5,"generatedOn":"2026-10-14T22:55:44.4290399Z","viewCount":0},{"id":27,"title":"4 Sum | Find Quads that add up to a target value","url":"4-sum-find-quads-that-add-up-to-a-target-value","description":null,"seoDescription":"","contentType":5,"generatedOn":"2026-10-14T22:55:44.4290414Z","viewCount":0},{"id":26,"title":"Top 50 Most Frequently Asked String Coding Problems (Interview Preparation )","url":"top-50-most-frequently-asked-string-coding-problems-interview-preparation","description":null,"seoDescription":"","contentType":5,"generatedOn":"2026-10-14T22:55:44.4290429Z","viewCount":0},{"id":25,"title":"Intersection of Two Sorted Arrays","url":"intersection-of-two-sorted-arrays","description":null,"seoDescription":"","contentType":5,"generatedOn":"2026-10-14T22:55:44.4290444Z","viewCount":0}]}}},"source":{"isMobile":false}}; window.__CLIENT_RENDER__ = false;