Skip to content

DSA

Algorithms, Data Structures, Competitive Coding, and problems from LeetCode with complete Solution Approach, Pseudocode, and Explanation.

Separate 0s and 1s

Separate 0s and 1s in an array – Single Iteration

🟢 Easy 🧩 Pattern – Arrays Given an array which contains only zeroes and ones, we need to seperate them by putting the zeroes first followed by the ones. Example Solution The zeroPointer variable is used to keep track of the index where the next zero should be placed.

Missing Number - 268

Missing Number – 268

🔗LC136 🟢 Easy 🧩 Pattern – XOR Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array. Example Solution Bitwise XOR operator ^ is the only way to solve this question, personally, I don’t… Read More »Missing Number – 268

Single Number - 136

Single Number – 136

🔗LC136 🟢 Easy 🧩 Pattern – XOR, Hashmap Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. You must implement a solution with a linear runtime complexity and use only constant extra space. Example Solution Bitwise XOR operator ^ is the only way to solve… Read More »Single Number – 136