ianidi / leetcode

📊My Leetcode environment for JavaScript, Java and Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

leetcode

Create a new problem

$ gulp init
prompt: num: <number>

It will generate a folder and files automatically.

Benchmark

$ npm run benchmark
$ node benchmark
$ node benchmark -t Roman

Test

$ npm test
$ mocha test
$ mocha test -t Roman

Test Java using mocha

$ mocha test -t '001.Two Sum' --java

Test Ruby using mocha

$ mocha test -t '001.Two Sum' --ruby

Links

# Title Solution
1520 Maximum Number of Non-Overlapping Substrings js
1519 Number of Nodes in the Sub-Tree With the Same Label js
1518 Water Bottles js
1514 Path with Maximum Probability js
1513 Number of Substrings With Only 1s js
1512 Number of Good Pairs js
1504 Count Submatrices With All Ones js
1503 Last Moment Before All Ants Fall Out of a Plank js
1502 Can Make Arithmetic Progression From Sequence js
1487 Making File Names Unique js
1486 XOR Operation in an Array js
1458 Max Dot Product of Two Subsequences js
1457 Pseudo-Palindromic Paths in a Binary Tree js
1456 Maximum Number of Vowels in a Substring of Given Length js
1455 Check If a Word Occurs As a Prefix of Any Word in a Sentence js
1430 Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree js
1429 First Unique Number js
1428 Leftmost Column with at Least a One js
1427 Perform String Shifts js
1426 Counting Elements js, go, python
1417 Reformat The String js
1414 Find the Minimum Number of Fibonacci Numbers Whose Sum Is K js
1413 Minimum Value to Get Positive Step by Step Sum js
1396 Design Underground System js
1395 Count Number of Teams js
1394 Find Lucky Integer in an Array js
1392 Longest Happy Prefix js
1391 Check if There is a Valid Path in a Grid js
1390 Four Divisors js
1389 Create Target Array in the Given Order js
1387 Sort Integers by The Power Value js
1386 Cinema Seat Allocation js
1385 Find the Distance Value Between Two Arrays js
1383 Maximum Performance of a Team js
1381 Design a Stack With Increment Operation js
1380 Lucky Numbers in a Matrix js
1379 Find a Corresponding Node of a Binary Tree in a Clone of That Tree js
1370 Increasing Decreasing String js
1368 Minimum Cost to Make at Least One Valid Path in a Grid js
1367 Linked List in Binary Tree js
1366 Rank Teams by Votes js
1365 How Many Numbers Are Smaller Than the Current Number js
1363 Largest Multiple of Three js
1362 Closest Divisors js
1361 Validate Binary Tree Nodes js
1360 Number of Days Between Two Dates js
1352 Product of the Last K Numbers js
1351 Count Negative Numbers in a Sorted Matrix js
1348 Tweet Counts Per Frequency js
1347 Minimum Number of Steps to Make Two Strings Anagram js
1346 Check If N and Its Double Exist js
1344 Angle Between Hands of a Clock js
1340 Jump Game V js
1339 Maximum Product of Splitted Binary Tree js
1338 Reduce Array Size to The Half js
1337 The K Weakest Rows in a Matrix js
1334 Find the City With the Smallest Number of Neighbors at a Threshold Distance js
1333 Filter Restaurants by Vegan-Friendly, Price and Distance js
1332 Remove Palindromic Subsequences js
1331 Rank Transform of an Array js
1329 Sort the Matrix Diagonally js
1328 Break a Palindrome js
1326 Minimum Number of Taps to Open to Water a Garden js
1325 Delete Leaves With a Given Value js
1324 Print Words Vertically js
1323 Maximum 69 Number js
1319 Number of Operations to Make Network Connected js
1318 Minimum Flips to Make a OR b Equal to c js
1317 Convert Integer to the Sum of Two No-Zero Integers js
1306 Jump Game III js
1305 All Elements in Two Binary Search Trees js
1304 Find N Unique Integers Sum up to Zero js
1293 Shortest Path in a Grid with Obstacles Elimination js
1292 Maximum Side Length of a Square with Sum Less than or Equal to Threshold js
1291 Sequential Digits js
1290 Convert Binary Number in a Linked List to Integer js
1289 Minimum Falling Path Sum II js
1287 Element Appearing More Than 25% In Sorted Array js
1286 Iterator for Combination js
1284 Minimum Number of Flips to Convert Binary Matrix to Zero Matrix js
1282 Group the People Given the Group Size They Belong To js
1281 Subtract the Product and Sum of Digits of an Integer js
1277 Count Square Submatrices with All Ones js
1276 Number of Burgers with No Waste of Ingredients js
1275 Find Winner on a Tic Tac Toe Game js
1269 Number of Ways to Stay in the Same Place After Some Steps js
1268 Search Suggestions System js
1267 Count Servers that Communicate js
1266 Minimum Time Visiting All Points js
1263 Minimum Moves to Move a Box to Their Target Location js
1262 Greatest Sum Divisible by Three js
1261 Find Elements in a Contaminated Binary Tree js
1260 Shift 2D Grid js
1255 Maximum Score Words Formed by Letters js
1254 Number of Closed Islands js
1253 Reconstruct a 2-Row Binary Matrix js
1252 Cells with Odd Values in a Matrix js
1249 Minimum Remove to Make Valid Parentheses js
1248 Count Number of Nice Subarrays js
1247 Minimum Swaps to Make Strings Equal js
1239 Maximum Length of a Concatenated String with Unique Characters js
1238 Circular Permutation in Binary Representation js
1237 Find Positive Integer Solution for a Given Equation js
1233 Remove Sub-Folders from the Filesystem js
1232 Check If It Is a Straight Line js
1222 Queens That Can Attack the King js
1221 Split a String in Balanced Strings js
1220 Count Vowels Permutation js
1219 Path with Maximum Gold js
1218 Longest Arithmetic Subsequence of Given Difference js
1217 Play with Chips js
1208 Get Equal Substrings Within Budget js
1202 Smallest String With Swaps js
1201 Ugly Number III js
1200 Minimum Absolute Difference js
1190 Reverse Substrings Between Each Pair of Parentheses js
1186 Maximum Subarray Sum with One Deletion js
1185 Day of the Week js
1184 Distance Between Bus Stops js
1175 Prime Arrangements js
1171 Remove Zero Sum Consecutive Nodes from Linked List js
1163 Last Substring in Lexicographical Order js
1162 As Far from Land as Possible js
1161 Maximum Level Sum of a Binary Tree js
1160 Find Words That Can Be Formed by Characters js
1156 Swap For Longest Repeated Character Substring js
1155 Number of Dice Rolls With Target Sum js
1154 Day of the Year js
1143 Longest Common Subsequence js
1137 N-th Tribonacci Number js
1123 Lowest Common Ancestor of Deepest Leaves js
1122 Relative Sort Array js
1111 Maximum Nesting Depth of Two Valid Parentheses Strings js
1110 Delete Nodes And Return Forest js
1109 Corporate Flight Bookings js
1108 Defanging an IP Address js
1105 Filling Bookcase Shelves js
1103 Distribute Candies to People js
1095 Find in Mountain Array js
1094 Car Pooling js
1093 Statistics from a Large Sample js
1091 Shortest Path in Binary Matrix js
1090 Largest Values From Labels js
1089 Duplicate Zeros js
1081 Smallest Subsequence of Distinct Characters js
1080 Insufficient Nodes in Root to Leaf Paths js
1079 Letter Tile Possibilities js
1078 Occurrences After Bigram js
1072 Flip Columns For Maximum Number of Equal Rows js
1071 Greatest Common Divisor of Strings js
1054 Distant Barcodes js
1053 Previous Permutation With One Swap js
1052 Grumpy Bookstore Owner js
1051 Height Checker js
1046 Last Stone Weight js, python
1044 Longest Duplicate Substring js
1042 Flower Planting With No Adjacent js
1041 Robot Bounded In Circle js
1038 Binary Search Tree to Greater Sum Tree js
1037 Valid Boomerang js
1035 Uncrossed Lines js
1032 Stream of Characters js
1030 Matrix Cells in Distance Order js
1029 Two City Scheduling js
1022 Sum of Root To Leaf Binary Numbers js
1021 Remove Outermost Parentheses js
1010 Pairs of Songs With Total Durations Divisible by 60 js
1008 Construct Binary Search Tree from Preorder Traversal js
1005 Maximize Sum Of Array After K Negations js
0999 Available Captures for Rook js
0997 Find the Town Judge js
0994 Rotting Oranges js
0993 Cousins in Binary Tree js
0987 Vertical Order Traversal of a Binary Tree js
0986 Interval List Intersections js
0983 Minimum Cost For Tickets js
0977 Squares of a Sorted Array js
0973 K Closest Points to Origin js
0967 Numbers With Same Consecutive Differences js
0965 Univalued Binary Tree js
0961 N-Repeated Element in Size 2N Array js
0958 Check Completeness of a Binary Tree js
0957 Prison Cells After N Days js
0951 Flip Equivalent Binary Trees js
0950 Reveal Cards In Increasing Order js
0949 Largest Time for Given Digits js
0944 Delete Columns to Make Sorted js, go, python
0943 Find the Shortest Superstring js
0942 DI String Match js
0941 Valid Mountain Array js
0938 Range Sum of BST js
0933 Number of Recent Calls js
0929 Unique Email Addresses js
0918 Maximum Sum Circular Subarray js
0905 Sort Array By Parity js
0901 Online Stock Span js
0897 Increasing Order Search Tree js
0896 Monotonic Array js
0890 Find and Replace Pattern js
0886 Possible Bipartition js
0884 Uncommon Words from Two Sentences js
0876 Middle of the Linked List js, go, python, cpp
0872 Leaf-Similar Trees js
0860 Lemonade Change js
0859 Buddy Strings js
0852 Peak Index in a Mountain Array js
0848 Shifting Letters js
0846 Hand of Straights js
0845 Longest Mountain in Array js
0844 Backspace String Compare js, go, python
0840 Magic Squares In Grid js
0836 Rectangle Overlap js
0835 Image Overlap js
0832 Flipping an Image js
0831 Masking Personal Information js
0830 Positions of Large Groups js
0829 Consecutive Numbers Sum js
0828 Unique Letter String js
0826 Most Profit Assigning Work js
0825 Friends Of Appropriate Ages js
0824 Goat Latin js
0822 Card Flipping Game js
0821 Shortest Distance to a Character js
0820 Short Encoding of Words js
0819 Most Common Word js
0817 Linked List Components js
0816 Ambiguous Coordinates js
0811 Subdomain Visit Count js
0807 Max Increase to Keep City Skyline js
0806 Number of Lines To Write String js
0805 Split Array With Same Average js
0804 Unique Morse Code Words js
0802 Find Eventual Safe States js
0801 Minimum Swaps To Make Sequences Increasing js
0800 Similar RGB Color js
0799 Champagne Tower js
0797 All Paths From Source to Target js
0796 Rotate String js
0791 Custom Sort String js
0789 Escape The Ghosts js
0788 Rotated Digits js
0787 Cheapest Flights Within K Stops js
0785 Is Graph Bipartite js
0784 Letter Case Permutation js
0783 Minimum Distance Between BST Nodes js
0779 K-th Symbol in Grammar js
0771 Jewels and Stones js
0766 Toeplitz Matrix js
0763 Partition Labels js
0760 Find Anagram Mappings js
0759 Employee Free Time js
0758 Bold Words in String js
0750 Number Of Corner Rectangles js
0748 Shortest Completing Word js
0746 Min Cost Climbing Stairs js
0744 Find Smallest Letter Greater Than Target js
0733 Flood Fill js
0731 My Calendar II js
0729 My Calendar I js
0720 Longest Word in Dictionary js
0707 Design Linked List js
0705 Design HashSet js
0704 Binary Search js
0703 Kth Largest Element in a Stream js
0701 Insert into a Binary Search Tree js
0700 Search in a Binary Search Tree js
0695 Max Area of Island js
0693 Binary Number with Alternating Bits js
0687 Longest Univalue Path js
0686 Repeated String Match js
0682 Baseball Game js
0681 Next Closest Time js
0680 Valid Palindrome II js
0679 24 Game js
0678 Valid Parenthesis String js
0677 Map Sum Pairs js
0669 Trim a Binary Search Tree js
0665 Non-decreasing Array js, ruby
0663 Equal Tree Partition js
0662 Maximum Width of Binary Tree js
0661 Image Smoother js
0660 Remove 9 js
0659 Split Array into Consecutive Subsequences js
0658 Find K Closest Elements js, ruby
0657 Judge Route Circle js, ruby
0656 Coin Path js
0655 Print Binary Tree js
0654 Maximum Binary Tree js
0653 Two Sum IV - Input is a BST js
0652 Find Duplicate Subtrees js
0651 4 Keys Keyboard js
0650 2 Keys Keyboard js
0649 Dota2 Senate js
0646 Maximum Length of Pair Chain js
0645 Set Mismatch js
0637 Average of Levels in Binary Tree js
0633 Sum of Square Numbers js
0628 Maximum Product of Three Numbers js
0627 Swap Salary sql
0621 Task Scheduler js
0617 Merge Two Binary Trees js
0599 Minimum Index Sum of Two Lists js, go
0594 Longest Harmonious Subsequence js
0581 Shortest Unsorted Continuous Subarray js
0572 Subtree of Another Tree js
0567 Permutation in String js
0566 Reshape the Matrix js, java
0563 Binary Tree Tilt js
0560 Subarray Sum Equals K js
0559 Maximum Depth of N-ary Tree js
0557 Reverse Words in a String III js
0543 Diameter of Binary Tree js, python
0540 Single Element in a Sorted Array js
0538 Convert BST to Greater Tree js
0535 Encode and Decode TinyURL js
0532 K-diff Pairs in an Array js
0530 Minimum Absolute Difference in BST js
0528 Random Pick with Weight js
0525 Contiguous Array js
0520 Detect Capital js
0518 Coin Change 2 js
0509 Fibonacci Number js
0507 Perfect Number js, java
0504 Base 7 js
0501 Find Mode in Binary Search Tree js
0500 Keyboard Row js, java
0492 Construct the rectangle js
0488 Zuma Game js
0487 Max Consecutive Ones II js
0486 Predict the Winner js
0485 Max Consecutive Ones js
0482 License Key Formatting js
0479 Largest Palindrome Product js, java
0476 Number Complement js, go
0468 Validate IP Address js
0463 Island Perimeter js
0461 Hamming Distance js
0459 Repeated Substring Pattern js
0455 Assign Cookies js
0453 Minimum Moves to Equal Array Elements js
0451 Sort Characters By Frequency js
0450 Delete Node in a BST js
0448 Find All Numbers Disappeared in an Array js
0443 String Compression js
0442 Find All Duplicates in an Array js
0441 Arranging Coins js
0438 Find All Anagrams in a String js
0437 Path Sum III js
0435 Non-overlapping Intervals js
0434 Number of Segments in a String js
0430 Flatten a Multilevel Doubly Linked List js
0415 Add Strings js
0414 Third Maximum Number js
0412 Fizz Buzz js, java
0409 Longest Palindrome js
0406 Queue Reconstruction by Height js
0405 Convert a Number to Hexadecimal js
0404 Sum of Left Leaves js
0402 Remove K Digits js
0401 Binary Watch js
0400 Nth Digit js
0392 Is Subsequence js
0389 Find the Difference js
0387 First Unique Character in a String js
0383 Ransom Note js, go
0380 Insert Delete GetRandom O(1) js
0378 Kth Smallest Element in a Sorted Matrix js
0374 Guess Number Higher or Lower java
0373 Find K Pairs with Smallest Sums js
0371 Sum of Two Integers js
0368 Largest Divisible Subset js
0367 Valid Perfect Square js
0350 Intersection of Two Arrays II js
0349 Intersection of Two Arrays js
0347 Top K Frequent Elements js
0345 Reverse Vowels of a String js
0344 Reverse String js, ts
0342 Power of Four js
0338 Counting Bits js
0332 Reconstruct Itinerary js
0329 Longest Increasing Path in a Matrix js
0328 Odd Even Linked List js
0326 Power of Three js
0303 Range Sum Query - Immutable js
0300 Longest Increasing Subsequence js
0299 Bulls and Cows js
0292 Nim Game js
0290 Word Pattern js
0289 Game of Life js, rust
0287 Find the Duplicate Number js
0283 Move Zeroes js, go, python
0279 Perfect Squares js
0278 First Bad Version js, go
0275 H-Index II js
0274 H-Index js
0268 Missing Number js
0264 Ugly Number II js
0263 Ugly Number js
0260 Single Number III js
0258 Add Digits js
0257 Binary Tree Paths js
0242 Valid Anagram js, ruby
0239 Sliding Window Maximum js
0238 Product of Array Except Self js
0237 Delete Node in a Linked List js
0235 Lowest Common Ancestor of a Binary Search Tree js, go
0234 Palindrome Linked List js
0232 Implement Queue using Stacks js
0231 Power of Two js, ruby
0230 Kth Smallest Element in a BST js
0227 Basic Calculator II js
0226 Invert Binary Tree js, ruby
0225 Implement Stack using Queues js, ruby
0222 Count Complete Tree Nodes js
0221 Maximal Square js
0219 Contains Duplicate II js, ruby
0217 Contains Duplicate js, ruby
0215 Kth Largest Element in an Array js
0212 Word Search II js
0210 Course Schedule II js
0208 Implement Trie (Prefix Tree) js
0207 Course Schedule js
0206 Reverse Linked List js, ruby
0205 Isomorphic Strings js
0204 Count Primes js
0203 Remove Linked List Elements js
0202 Happy Number js, go
0201 Bitwise AND of Numbers Range js
0200 Number of Islands js
0198 House Robber js
0197 Rising Temperature sql
0196 Delete Duplicate Emails sql
0195 Tenth Line bash
0193 Valid Phone Numbers bash
0191 Number of 1 Bits js
0190 Reverse Bits js, java
0189 Rotate Array js, go
0183 Customers Who Never Order sql
0182 Duplicate Emails sql
0181 Employees Earning More Than Their Managers sql
0179 Largest Number js
0176 Second Highest Salary sql
0175 Combine Two Tables sql
0174 Dungeon Game js
0172 Factorial Trailing Zeroes js, ruby
0171 Excel Sheet Column Number js, ruby
0169 Majority Element js
0168 Excel Sheet Column Title js, go
0167 Two Sum II - Input array is sorted js, go, python, java
0162 Find Peak Element js
0160 Intersection of Two Linked Lists js
0155 Min Stack js
0154 Find Minimum in Rotated Sorted Array II js
0153 Find Minimum in Rotated Sorted Array js
0152 Maximum Product Subarray js
0151 Reverse Words in a String js
0149 Max Points on a Line js
0148 Sort List js
0146 LRU Cache js
0142 Linked List Cycle II js
0141 Linked List Cycle js
0140 Word Break II js
0139 Word Break js
0137 Single Number II js
0136 Single Number js, go
0130 Surrounded Regions js
0129 Sum Root to Leaf Numbers js
0128 Longest Consecutive Sequence js
0125 Valid Palindrome js
0124 Binary Tree Maximum Path Sum js
0123 Best Time to Buy and Sell Stock III js
0122 Best Time to Buy and Sell Stock II js, go, python
0121 Best Time to Buy and Sell Stock js, rust, java
0119 Pascal's Triangle II js
0118 Pascal's Triangle js
0115 Distinct Subsequences js
0112 Path Sum js
0111 Minimum Depth of Binary Tree js
0110 Balanced Binary Tree js
0108 Convert Sorted Array to Binary Search Tree js
0107 Binary Tree Level Order Traversal II js
0106 Construct Binary Tree from Inorder and Postorder Traversal js
0104 Maximum Depth of Binary Tree js, java
0103 Binary Tree Zigzag Level Order Traversal js
0102 Binary Tree Level Order Traversal js
0101 Symmetric Tree js
0100 Same Tree js, go
0098 Validate Binary Search Tree js
0096 Unique Binary Search Trees js
0094 Binary Tree Inorder Traversal js
0089 Gray Code js
0088 Merge Sorted Array js, java
0083 Remove Duplicates from Sorted List js
0082 Remove Duplicates from Sorted List II js
0079 Word Search js
0078 Subsets js
0076 Minimum Window Substring js
0075 Sort Colors js
0072 Edit Distance js
0070 Climbing Stairs js, java
0069 Sqrt(x) js
0067 Add Binary js, java
0066 Plus One js, java
0064 Minimum Path Sum js
0063 Unique Paths II js
0062 Unique Paths js
0060 Permutation Sequence js
0058 Length of Last Word js, java
0055 Jump Game js, go
0053 Maximum Subarray js, go, java
0051 N-Queens js
0050 Pow(x, n) js
0049 Group Anagrams js, go, python
0046 Permutations js
0042 Trapping Rain Water js
0039 Combination Sum js
0038 Count and Say js
0036 Valid Sudoku js
0035 Search Insert Position js, java
0034 Find First and Last Position of Element in Sorted Array js
0033 Search in Rotated Sorted Array js
0032 Longest Valid Parentheses js
0028 Implement strStr js, java
0027 Remove Element js, java
0026 Remove Duplicates from Sorted Array js, java
0024 Swap Nodes in Pairs js
0023 Merge k Sorted Lists js
0022 Generate Parentheses js
0021 Merge Two Sorted Lists js, java
0020 Valid Parentheses js, java
0019 Remove Nth Node From End of List js
0018 4Sum js
0017 Letter Combinations of a Phone Number js
0016 3Sum Closest js
0015 3Sum js
0014 Longest Common Prefix js, java
0013 Roman to Integer js
0012 Integer to Roman js
0011 Container With Most Water js, ruby
0009 Palindrome Number js, java
0008 String to Integer js
0007 Reverse Integer js, java
0006 ZigZag Conversion js
0005 Longest Palindromic Substring js
0004 Median of Two Sorted Arrays js
0003 Longest Substring Without Repeating Characters js
0002 Add Two Numbers js
0001 Two Sum js, go, java, ruby

About

📊My Leetcode environment for JavaScript, Java and Ruby


Languages

Language:JavaScript 95.2%Language:Java 1.5%Language:TypeScript 1.2%Language:Go 0.8%Language:Ruby 0.5%Language:Python 0.4%Language:Rust 0.3%Language:C++ 0.0%Language:TSQL 0.0%Language:Shell 0.0%