Skip to content
Unique Pairs with Target Sum

Unique Pairs with Target Sum

🟢 Easy 🧩 Pattern – Arrays and Hashmap Given an array of distinct integers and a target sum, return an array of unique pairs of numbers which add up to the target sum. Each pair should be represented as an array containing only two numbers. Example Solution

Majority Element - 169

Majority Element – 169

🔗LC169 🟢 Easy 🧩 Pattern – Arrays and Hashmap Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array. Example Solution

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