A small JavaScript practice repository for working through common algorithm and data structure problems.
-
Two Sum
- Find two indices whose values add up to a target.
-
Move Zeroes
- Move all zeroes to the end of an array while preserving the order of non zero values.
-
Find the Second Largest Element in an Array
- Return the second largest distinct value, or
-1when one does not exist.
- Return the second largest distinct value, or
-
Contains Duplicate
- Determine whether an array contains any repeated value.
-
Longest Substring Without Repeating Characters
- Find the length of the longest substring containing unique characters.
-
Anagram Check
- Determine whether two strings contain the same characters with the same frequencies.
-
Remove Adjacent Duplicates
- Repeatedly remove matching adjacent character pairs until none remain.
-
Reverse the First K Elements of a Queue
- Reverse only the first
kelements of a queue while leaving the rest in order.
- Reverse only the first
Open the AlgoPractice.js file inside an IDE like Visual Studio Code then right click run it inside your IDE's terminal. Results from the console log statements will then be printed to the Output section of your IDE.