Skip to content

A collection of my solutions to LeetCode problems, written for learning, practice, and fun.

Notifications You must be signed in to change notification settings

Abbas8984/leetcode

Repository files navigation

LeetCode

A collection of my solutions to LeetCode problems, written for learning, practice, and fun.
Each solution is written with readability and efficiency in mind.


Structure

Each file is named after the problem title or number, e.g. 0001-two-sum.js.


Topics

  • Arrays & Strings
  • Hash Maps
  • Two Pointers
  • Sliding Window
  • Recursion & Backtracking
  • Trees & Graphs
  • Dynamic Programming
  • Greedy Algorithms

Example

// 1. Two Sum
var twoSum = function(nums, target) {
    const map = new Map();
    for (let i = 0; i < nums.length; i++) {
        const diff = target - nums[i];
        if (map.has(diff)) {
            return [map.get(diff), i];
        }
        map.set(nums[i], i);
    }
};