Skip to content

Exercising my problem solving skills by solving coding challenges and optimizing my result for best solution with data structures and complexity analysis.

Notifications You must be signed in to change notification settings

osaf96/Data-structures-and-algorithm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data structure and algorithms

Exercising my problem solving skills by solving coding challenges and optimizing my result for best solution with data structures and complexity analysis.

Problems are categorized into folders named after their sources:

  1. Leetcode
  2. hackerRank

Index of solved leetcode questions

Before you run any test, please be sure that the test case does not have (x) before it, this means the test would be skipped. To run the test, remove the (x) letter.

javascript

Index Question Solution & Test Difficulty Tag Topic
1 Two Sum Solution Easy Array, Hash Table ARRAY
2 Add Two Numbers Solution Medium Math, Linked List, recursion LINKED LIST
3 Longest Substring Without Repeating Characters Solution Medium Hash table, string, sliding window STRING
4 Median of Two sorted Arrays Solution Hard Array, Binary Search, Divide and Conquer ARRAY
5 Longest Palindromic Substring Solution Medium String, Dynamic Programmming STRING
7 Reverse Integer Solution Medium Math ARRAY
9 Palindrome Number Solution Easy Math ARRAY
13 Roman to Integer Solution Easy Hashtable, Math, String STRING
15 3Sum Solution Medium Array, Two Pointers, Sorting ARRAY
20 Valid Parentheses Solution Easy Stack, String
21 Merge Two Sorted Lists Solution Easy Linked List, Recursion
26 Remove Duplicates from Sorted Array Solution Easy Array, Two Pointers
27 Remove Element Solution Easy Array, Two Pointers
49 Group Anagrams Solution Medium Hash Table, String, Sorting
53 Maximum Subarray Solution Easy Array, Divide and Conquer, Dynamic Programming Amazon
78 Subsets Solution Medium Array, Backtracking, Bit manipulation
100 Same Tree Solution Easy Tree, Depth-first search, Breadth-first search, Binary Tree
104 Maximum Depth of Binary Tree Solution Easy Array, Depth-first search, Breadth-first search
110 Balanced Binary Tree Solution Easy Tree, Depth-first search
121 Best Time to Buy and Sell Stock Solution Easy Array, Dynamic Programming
122 Best Time to Buy and Sell Stock II Solution Easy Array, Dynamic Programming, Greedy
125 Valid Palindrome Solution Easy Two pointers, string
155 Min Stack Solution Easy Stack, Design
167 Two Sum II - Input Array is sorted Solution Medium Array, Two pointers, Binary Search
202 Happy Number Solution Easy Hash Table, Math, Two Pointers
206 Reverse Linked List Solution Easy Linked List, Recursion
208 Implement Trie (Prefix Tree) Solution Medium Hash Table, String, Design, Trie
211 Design Add and Search Words Data Structure Solution Medium Depth-first search, String, Design, Trie
215 Kth Largest Element in an Array Solution Medium Array, Divide and Conquer, Sorting, Heap(Priority Queue), Quickselect
217 Contains Duplicate Solution Easy Array, Hash Table, Sorting Microsoft
219 Contains Duplicate II Solution Easy Array, Hash Table, Sliding window Google
225 Implement Stack Using Queue Solution Easy Design, Stack, Queue
226 Invert Binary Tree Solution Easy Depth first search, Breadth first search, Binary Tree
234 Palindrome Linked List Solution Easy Linked List, Two Pointers, Stack, Recursion
327 Top K Frequent Elements Solution Medium Array, Hash Table, Divide and Conquer, Sorting, Heap(Priority Queue), Bucket Sort, Counting, Quick Select
543 Diameter of Binary Tree Solution Easy Tree, Depth first search, Binary Tree
581 Shortest Contiguous SubArray Solution Medium Array, Two Pointers, Stack, Greedy, Monotonic Array, Sorting
703 Kth Largest Element in a Stream Solution Easy Tree, Design, Binary Search Tree, Heap(Priority Queue), Binary Tree, Data Stream
704 Binary search Solution Easy Array, Binary Search
905 Sort Array By Parity Solution Easy Array, Two Pointers, Sorting
973 K Closest Points to Origin Solution Medium Array, Math, Divide and Conquer, Heap(Priority Queue), Quickselect, Geometry, Sorting
1046 Last stone Weight Solution Easy Array, Heap(Priority Queue)
1209 Remove All Adjacent Duplicates in String II Solution Medium String, Stack Amazon
1379 Find a Corresponding Node of a Binary Tree in a Clone of That Tree Solution Medium Tree, Depth-first Search, Breadth-first Search, Binary Tree
1502 Can Make Arithmetic Progression From Sequence Solution Easy Array, Sorting
1679 Max Number of K-Sum Pairs Solution Medium Array, Sorting, Hash Table, Two Pointers
1790 Check if One String Swap Can Make Strings Equal Solution Easy Hash Table, String, Counting
1822 Sign of the Product of an Array Solution Easy Array, Math

Backtracking

No LC Index Question Solution & Test Difficulty Tags
1 39 Combination Sum Solution Medium Array, Backtracking, Depth First search, Recursion
2 46 Permutations Solution Medium Array, Backtracking
3 78 Subsets Solution Medium Array, Backtracking, Bit Manipulation
4 90 Subsets II Solution Medium Array, Backtracking, Bit Manipulation

Matrix

No LC Index Question Solution & Test Difficulty Tags
1 867 Transpose Matrix Solution Easy Array, Matrix, Simulation
2 304 Range Sum Query 2D - Immutable Solution Medium Array, Design, Matrix, Prefix Sum
3 51 N-Queens Solution Hard Array, Backtracking
4 52 N-Queens II Solution Hard Backtracking

Array

No LC Index Question Solution & Test Difficulty Tags
1 1480 Running Sum of 1d Array Solution Easy Array, Prefix sum
2 238 Product of Array Except Self Solution Medium Array, Prefix sum
3 88 Merge sorted Array Solution Easy Array, Two Pointers, Sorting
4 36 Valid Sudoku Solution Medium Array, Hash Table, Matrix
5 167 Two Sum II - Input Array Is Sorted Solution Medium Array, Two Pointers, Binary Search
6 2108 Find First Palindromic String in the Array Solution Easy Array, Two-pointers, Strings
7 2016 Maximum Difference Between Increasing Elements Solution Easy Array
8 1658 Minimum Operations to reduce x to zero Solution Medium Array, Hash Table, Binary Search, Sliding window, Prefix sum
9 1658 Maximum Erasure Value Solution Medium Array, Hash Table, Sliding window
10 128 Longest Consecutive Sequence Solution Medium Array, Hash Table, Union Find
11 11 Container With Most Water Solution Medium Array, Two Pointers, Greedy
12 42 Trapping Rain Water Solution Hard Array, Two Pointers, Dynamic Programming, Stack, Monotonic Stack

Linked List

No LC Index Question Solution & Test Difficulty Tags
1 160 Intersection of Two Linked List Solution Easy Hash Table, Linked List, Two Pointers

Strings

No LC Index Question Solution & Test Difficulty Tags
1 1332 Remove Palindromic Subsequence Solution Easy String, Two Pointers
2 3 Longest Substring without repeating characters Solution Medium String, Hash Table, Sliding window
3 - Encode and decode strings Solution Medium String, Design
4 424 Longest Repeating Character Replacement Solution Medium Hash Table, String, Sliding Window

1-D Dynamic Programming

No LC Index Question Solution & Test Difficulty Tags
1 70 Climbing Stairs Solution Easy Math, Dynamic Programming, Memoization
2 583 Delete operation for two strings Solution Medium String, Dynamic Programming

2-D Dynamic Programming

No LC Index Question Solution & Test Difficulty Tags
1 120 Triangle Solution Medium Array, Dynamic Programming

Graph

No LC Index Question Solution & Test Difficulty Tags
1 200 Number of Islands Solution Medium Graph, Depth First Search, Breadth First Search, Union Find, Matrix
2 1971 Find If Path Exists in Graph Solution Easy Graph, Depth First Search, Breadth First Search
3 997 Find the town Judge Solution Easy Array, Graph, Hash table

Authors

🌸 Blossom

About

Exercising my problem solving skills by solving coding challenges and optimizing my result for best solution with data structures and complexity analysis.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 65.6%
  • Python 28.3%
  • CSS 3.6%
  • HTML 2.5%