Skip to content

Hashmap

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

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