/algorithms

:bar_chart: My daily algorithm challenges

Primary LanguageJavaScript

Algorithms

A collection of my daily algorithm challenges.

Usage

To make a new directory, run the following command on your CLI:

$ yarn start

mode: Choose a mode

# Directory
0 LeetCode
1 Hacker Rank
2 Others
prompt: mode:  0

name: enter the question title (directory name)

prompt: name: [Question title]

LeetCode

https://leetcode.com/

# Title Difficulty Language
1 Two Sum Easy JavaScript, Java
3 Longest Substring Without Repeating Characters Medium JavaScript
7 Reverse Integer Easy JavaScript, Java
9 Palindrome Number Easy JavaScript, Java
11 Container With Most Water Medium JavaScript
13 Roman to Integer Easy JavaScript, Java
14 Longest Common Prefix Easy JavaScript, Java
15 3Sum Medium JavaScript
20 Valid Parentheses Easy JavaScript, Java
21 Merge Two Sorted Lists Easy JavaScript
24 Swap Nodes in Pairs Medium JavaScript
26 Remove Duplicates from Sorted Array Easy JavaScript
27 Remove Element Easy JavaScript
28 Implement strStr() Easy JavaScript, Java
33 Search in Rotated Sorted Array Medium JavaScript
34 Find First and Last Position of Element in Sorted Array Medium JavaScript
35 Search Insert Position Easy JavaScript, Java
36 Valid Sudoku Medium JavaScript
39 Combination Sum Medium JavaScript
40 Combination Sum II Medium JavaScript
42 Trapping Rain Water Hard JavaScript
46 Permutations Medium JavaScript
49 Group Anagrams Medium JavaScript
53 Maximum Subarray Easy JavaScript, Java
55 Jump Game Medium JavaScript
58 Length of Last Word Easy JavaScript, Java
62 Unique Paths Medium JavaScript
64 Minimum Path Sum Medium JavaScript
66 Plus One Easy JavaScript, Java
67 Add Binary Easy JavaScript, Java
69 Sqrt(x) Easy JavaScript, Java
70 ClimbingStairs Easy JavaScript, Java
74 Search a 2D Matrix Medium JavaScript
78 Subsets Medium JavaScript
79 Word Search Medium JavaScript
83 Remove Duplicates from Sorted List Easy JavaScript
88 Merge Sorted Array Easy JavaScript, Java
89 Gray Code Medium JavaScript
90 Subsets II Medium JavaScript
94 Binary Tree Inorder Traversal Medium JavaScript
98 Validate Binary Search Tree Medium JavaScript
100 Same Tree Easy JavaScript, Java
101 Symmetric Tree Easy JavaScript, Java
102 Binary Tree Level Order Traversal Medium JavaScript
104 Maximum Depth of Binary Tree Easy JavaScript, Java
105 Construct Binary Tree from Preorder and Inorder Traversal Medium JavaScript
107 Binary Tree Level Order Traversal II Easy JavaScript
108 Convert Sorted Array to Binary Search Tree Easy JavaScript
110 Balanced Binary Tree Easy Javascript
111 Minimum Depth of Binary Tree Easy JavaScript
112 Path Sum Easy JavaScript
116 Populating Next Right Pointers in Each Node Medium JavaScript
118 Pascal's Triangle Easy JavaScript
121 Best Time to Buy and Sell Stock Easy JavaScript, Java
122 Best Time to Buy and Sell Stock II Easy JavaScript
124 Binary Tree Maximum Path Sum Hard JavaScript
125 Valid Palindrome Easy JavaScript
128 Longest Consecutive Sequence Medium JavaScript
129 Sum Root to Leaf Numbers Medium JavaScript
130 Surrounded Regions Medium JavaScript
136 Single Number Easy JavaScript
141 Linked List Cycle Easy JavaScript
142 Linked List Cycle II Medium JavaScript
144 Binary Tree Preorder Traversal Easy JavaScript
145 Binary Tree Postorder Traversal Easy JavaScript
146 LRU Cache Medium JavaScript
153 Find Minimum in Rotated Sorted Array Medium JavaScript
155 Min Stack Easy JavaScript
160 Intersection of Two Linked Lists Easy JavaScript
167 Two Sum II Easy JavaScript, Java
168 Excel Sheet Column Title Easy JavaScript, Java
169 Majority Element Easy JavaScript, Java
171 Excel Sheet Column Number Easy JavaScript
172 Factorial Trailing Zeroes Easy JavaScript
173 Binary Search Tree Iterator Medium JavaScript
189 Rotate Array Easy JavaScript, Java
190 Reverse Bits Easy Java
191 Number of 1 Bits Easy Java
198 House Robber Easy JavaScript
199 Binary Tree Right Side View Medium JavaScript
200 Number of Islands Medium JavaScript
201 Bitwise AND of Numbers Range Medium JavaScript
206 Reverse Linked List Easy JavaScript
208 Implement Trie (Prefix Tree) Medium JavaScript
209 Minimum Size Subarray Sum Medium JavaScript
210 Course Schedule II Medium JavaScript
217 Contains Duplicate Easy JavaScript
221 Maximal Square Medium JavaScript
222 Count Complete Tree Nodes Medium JavaScript
230 Kth Smallest Element in a BST Medium JavaScript
232 Implement Queue using Stacks Easy JavaScript
234 Palindrome Linked List Easy JavaScript
235 Lowest Common Ancestor of a Binary Search Tree Medium JavaScript
237 Delete Node in a Linked List Easy JavaScript
238 Product of Array Except Self Medium JavaScript
242 Valid Anagram Easy Java
257 Binary Tree Paths Easy JavaScript
266 Invert Binary Tree Easy JavaScript
268 Missing Number Easy JavaScript
274 H-Index Medium JavaScript
275 H-Index II Medium JavaScript
278 First Bad Version Easy JavaScript
283 Move Zeroes Easy JavaScript
289 Game of Life Medium JavaScript
297 Serialize and Deserialize Binary Tree Hard JavaScript
344 Reverse String Easy JavaScript, Java
342 Power of Four Easy JavaScript
345 Reverse Vowels of a String Easy JavaScript
347 Top K Frequent Elements Medium JavaScript
349 Intersection of Two Arrays Easy JavaScript
350 Intersection of Two Arrays II Easy Java
367 Valid Perfect Square Easy JavaScript
373 Find K Pairs with Smallest Sums Medium JavaScript
380 Insert Delete GetRandom O(1) Medium JavaScript
383 Ransom Note Easy JavaScript
387 First Unique Character in a String Easy JavaScript
389 Find the Difference Easy JavaScript
392 Is Subsequence Easy JavaScript
402 Remove K Digits Medium JavaScript
404 Sum of Left Leaves Easy JavaScript
409 Longest Palindrome Easy JavaScript
412 Fizz Buzz Easy JavaScript, Java
424 Longest Repeating Character Replacement Medium JavaScript
443 String Compression Easy JavaScript
448 Find All Numbers Disappeared in an Array Easy Java
479 Largest Palindrome Product Hard Java
485 Max Consecutive Ones Easy JavaScript
500 Keyboard Row Easy Java
504 Base 7 Easy JavaScript, Java
507 Perfect Number Easy Java
525 Contiguous Array Medium JavaScript
528 Random Pick with Weight Medium JavaScript
532 K-diff Pairs in an Array Easy Java
540 Single Element in a Sorted Array Medium JavaScript
543 Diameter of Binary Tree Easy Java
547 Number of Provinces Medium JavaScript
556 Reshape The Matrix Easy Java
557 Reverse Words in a String III Easy JavaScript
559 Maximum Depth of N-ary Tree Easy JavaScript
560 Subarray Sum Equals K Medium JavaScript
567 Permutation in String Medium JavaScript
572 Subtree of Another Tree Easy JavaScript
581 Shortest Unsorted Continuous Subarray Easy JavaScript
599 Minimum Index Sum of Two Lists Easy JavaScript
605 Can Place Flowers Easy JavaScript
617 Merge Two Binary Trees Easy JavaScript
633 Sum of Square Numbers Easy JavaScript
637 Average of Levels in Binary Tree Easy JavaScript
643 Maximum Average Subarray I Easy JavaScript
645 Set Mismatch Easy JavaScript
658 Find K Closest Elements Medium JavaScript
660 Remove 9 Hard Java
678 Valid Parenthesis String Medium JavaScript
680 Valid Palindrome II Easy Java
669 Trim a Binary Search Tree Easy JavaScript
695 Max Area of Island Medium JavaScript
700 Search in a Binary Search Tree Easy JavaScript
704 Binary Search Easy JavaScript
720 Longest Word in Dictionary Easy JavaScript
733 Flood Fill Easy JavaScript
744 Find Smallest Letter Greater Than Target Easy JavaScript
746 Min Cost Climbing Stairs Easy JavaScript
747 Largest Number At Least Twice of Others Easy JavaScript
760 Find Anagram Mappings Easy JavaScript
771 Jewels and Stones Easy JavaScript
783 Minimum Distance Between BST Nodes Easy JavaScript
789 Escape The Ghosts Medium JavaScript
796 Rotate String Easy JavaScript
802 Find Eventual Safe States Medium JavaScript
804 Unique Morse Code Words Easy JavaScript
806 Number of Lines To Write String Easy JavaScript
819 Most Common Word Easy Javascript
821 Shortest Distance to a Character Easy Javascript
832 Flipping an Image Easy JavaScript
844 Backspace String Compare Easy JavaScript
849 Maximize Distance to Closest Person Easy JavaScript
852 Peak Index in a Mountain Array Easy JavaScript
860 Lemonade Change Easy JavaScript
872 eaf-Similar Trees Easy JavaScript
876 Middle of the Linked List Easy JavaScript
875 Koko Eating Bananas Medium JavaScript
884 Uncommon Words from Two Sentences Easy JavaScript
897 Increasing Order Search Tree Easy JavaScript
905 Sort Array By Parity Easy JavaScript
922 Sort Array By Parity II Easy JavaScript
929 Unique Email Addresses Easy JavaScript
938 Range Sum of BST Easy JavaScript
941 Valid Mountain Array Easy JavaScript
949 Largest Time for Given Digits Easy JavaScript
965 Univalued Binary Tree Easy JavaScript
973 K Closest Points to Origin Medium JavaScript
983 Minimum Cost For Tickets Medium JavaScript
993 Cousins in Binary Tree Easy JavaScript
997 Find the Town Judge Easy JavaScript
999 Available Captures for Rook Easy JavaScript
1005 Maximize Sum Of Array After K Negations Easy JavaScript
1008 Construct Binary Search Tree from Preorder Traversal Medium JavaScript
1029 Two City Scheduling Easy JavaScript
1035 Uncrossed Lines Medium JavaScript
1037 Valid Boomerang Easy JavaScript
1038 Binary Search Tree to Greater Sum Tree Medium JavaScript
1046 Last Stone Weight Easy JavaScript
1078 Occurrences After Bigram Easy JavaScript
1143 Longest Common Subsequence Medium JavaScript
1184 Distance Between Bus Stops Easy JavaScript
1201 Ugly Number III Medium JavaScript
1207 Unique Number of Occurrences Easy JavaScript
1217 Play with Chips Easy JavaScript
1219 Path with Maximum Gold Easy JavaScript
1221 Split a String in Balanced Strings Easy JavaScript
1222 Queens That Can Attack the King Medium JavaScript
1232 Check If It Is a Straight Line Easy JavaScript
1238 Circular Permutation in Binary Representation Medium JavaScript
1247 Minimum Swaps to Make Strings Equal Easy JavaScript
1252 Cells with Odd Values in a Matrix Easy JavaScript
1253 Reconstruct a 2-Row Binary Matrix Medium JavaScript
1260 Shift 2D Grid Easy JavaScript
1261 Find Elements in a Contaminated Binary Tree Medium JavaScript
1266 Minimum Time Visiting All Points Easy JavaScript
1267 Count Servers that Communicate Medium JavaScript
1268 Search Suggestions System Medium JavaScript
1275 Find Winner on a Tic Tac Toe Game Easy JavaScript
1281 Subtract the Product and Sum of Digits of an Integer Easy JavaScript
1282 Group the People Given the Group Size They Belong To Medium JavaScript
1283 Find the Smallest Divisor Given a Threshold Medium JavaScript
1287 Element Appearing More Than 25% In Sorted Array Easy JavaScript
1290 Convert Binary Number in a Linked List to Integer Easy JavaScript
1295 Find Numbers with Even Number of Digits Easy JavaScript
1296 Divide Array in Sets of K Consecutive Numbers Medium JavaScript
1304 Find N Unique Integers Sum up to Zero Easy JavaScript
1315 Sum of Nodes with Even-Valued Grandparent Medium JavaScript
1337 Remove Palindromic Subsequences Easy JavaScript
1338 Filter Restaurants by Vegan-Friendly, Price and Distance Medium JavaScript
1346 Check If N and Its Double Exist Easy JavaScript
1347 Minimum Number of Steps to Make Two Strings Anagram Medium JavaScript
1348 Tweet Counts Per Frequency Medium JavaScript
1351 Count Negative Numbers in a Sorted Matrix Frequency Easy JavaScript
1352 Product of the Last K Numbers Medium JavaScript
1360 Number of Days Between Two Dates Easy JavaScript
1365 How Many Numbers Are Smaller Than the Current Number Easy JavaScript
1374 Generate a String With Characters That Have Odd Counts Easy JavaScript
1389 Create Target Array in the Given Order Easy JavaScript
1390 Four Divisors Medium JavaScript
1394 Find Lucky Integer in an Array Easy JavaScript
1395 Count Number of Teams Medium JavaScript
1396 Design Underground System Medium JavaScript
1418 Display Table of Food Orders in a Restaurant Medium JavaScript
1419 Minimum Number of Frogs Croaking Medium JavaScript
1436 Destination City Easy JavaScript
1448 Count Good Nodes in Binary Tree Medium JavaScript
1502 Can Make Arithmetic Progression From Sequence Easy JavaScript
1557 Minimum Number of Vertices to Reach All Nodes Medium JavaScript
1791 Find Center of Star Graph Easy JavaScript
1971 Find if Path Exists in Graph Easy JavaScript
2160 Minimum Sum of Four Digit Number After Splitting Digits Easy JavaScript
2236 Root Equals Sum of Children Easy JavaScript
2265 Count Nodes Equal to Average of Subtree Medium JavaScript
2331 Evaluate Boolean Binary Tree Easy JavaScript
2375 Construct Smallest Number From DI String Medium JavaScript
2685 Count the Number of Complete Components Medium JavaScript

HackerRank

https://www.hackerrank.com/

001.Warmup

Title Language
A Very Big Sum JavaScript, Java
Birthday Cake Candles JavaScript, Java
Compare the Triplets JavaScript, Java
Diagonal Difference JavaScript, Java
Mini-Max Sum JavaScript, Java
Plus Mins JavaScript, Java
Simple Array Sum Java, Python, JavaScript
Solve Me First Java, Python, JavaScript
Staircase JavaScript, Java
Time Conversion JavaScript, Java

002.Implementation

Title Language
Apple and Orange JavaScript
Grading Students JavaScript, Java
Kangaroo JavaScript

003.Strings

Title Language
Camel Case Java
Super Reduced String JavaScript, Java

004.Sorting

Title Language
Counting Sort 1 Java
Intro to Tutorial Challenges JavaScript

005.Search

Title Language
Ice Cream Parlor JavaScript

Tutorials

10 Days of JavaScript

Title Language
Day 0: Data Types JavaScript
Day 0: Hello, World! JavaScript
Day 1: Arithmetic Operators JavaScript
Day 1: Functions JavaScript
Day 1: Let and Const JavaScript
Day 2: Conditional Statements: If-Else JavaScript
Day 2: Conditional Statements: Switch JavaScript
Day 2: Loops JavaScript
Day 3: Arrays JavaScript
Day 3: Throw JavaScript
Day 3: Try, Catch, and Finally JavaScript
Day 4: Classes JavaScript
Day 4: Count Objects JavaScript
Day 4: Create a Rectangle Object JavaScript
Day 5: Arrow Functions JavaScript
Day 5: Inheritance JavaScript
Day 5: Template Literals JavaScript
Day 6: Bitwise Operators JavaScript
Day 6: JavaScript Dates JavaScript
Day 7: Regular Expressions I JavaScript
Day 7: Regular Expressions II JavaScript
Day 7: Regular Expressions III JavaScript
Day 8: Buttons Container HTML+CSS+JavaScript
Day 8: Create a Button HTML+CSS+JavaScript

Cracking the Coding Interview

Category Title Language
DATA STRUCTURES Arrays: Left Rotation JavaScript
Strings: Making Anagrams JavaScript
Hash Tables: Ransom Note JavaScript
ALGORITHMS Sorting: Bubble Sort JavaScript

DMOJ

https://dmoj.ca/

# Title Language
J4 Big Bang Secrets Java
S1 Computer Purchase Java
S2 Huffman Encoding Java

Others

# Title Language
1 Regular Expressions (JavaScript)
2 Web Development Fundamentals HTML+CSS+JavaScript
4 String Permutation Java
5 Primitive or Reference JavaScript
10 Probability of lottery JavaScript