Skip to content

This repo consists of codes that I practiced in my free time to build up my problem solving.

Notifications You must be signed in to change notification settings

jaina15/LeetCode_Codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 

Repository files navigation

Leetcode

# Title Solution Runtime
1 Two Sum Python3 102 ms
2 Add Two Numbers Python3 120 ms
3 Longest Substring Without Repeating Characters Python3 129 ms
4 Median of Two Sorted Arrays Python3 156 ms
5 Longest Palindromic Substring Python3 319 ms
9 Palindrome Number Python3 51 ms
11 Container With Most Water Python3 533 ms
14 Longest Common Prefix Python3 29 ms
15 3Sum Python3 913 ms
16 3Sum Closest Python3 416 ms
18 4Sum Python3 414 ms
19 Remove Nth Node From End of List Python3 34 ms
20 Valid Parentheses Python3 46 ms
21 Merge Two Sorted Lists Python3 34 ms
24 Swap Nodes in Pairs Python3 30 ms
25 Reverse Nodes in k-Group Python3 46 ms
26 Remove Duplicates from Sorted Array Python3 90 ms
27 Remove Element Python3 44 ms
28 Find the Index of the First Occurrence in a String Python3 40 ms
31 Next Permutation Python3 51 ms
34 Find First and Last Position of Element in Sorted Array Python3 172 ms
41 First Missing Positive C++ 120 ms
42 Trapping Rain Water Python3 100 ms
49 Group Anagrams Python3 107 ms
53 Maximum Subarray Python3 593 ms
58 Length of Last Word Python3 47 ms
61 Rotate List Python3 34 ms
66 Plus One Python3 35 ms
75 Sort Colors Python3 48 ms
82 Remove Duplicates from Sorted List II Python3 40 ms
83 Remove Duplicates from Sorted List Python3 41 ms
86 Partition List Python3 36 ms
88 Merge Sorted Array Python3 42 ms
92 Reverse Linked List II Python3 32 ms
94 Binary Tree Inorder Traversal Python3 35 ms
96 Unique Binary Search Trees Python3 32 ms
98 Validate Binary Search Tree Python3 40 ms
99 Recover Binary Search Tree Python3 80 ms
100 Same Tree Python3 43 ms
101 Symmetric Tree Python3 34 ms
102 Binary Tree Level Order Traversal Python3 42 ms
103 Binary Tree Zigzag Level Order Traversal Python3 35 ms
104 Maximum Depth of Binary Tree Python3 43 ms
105 Construct Binary Tree from Preorder and Inorder Traversal Python3 56 ms
106 Construct Binary Tree from Inorder and Postorder Traversal Python3 60 ms
107 Binary Tree Level Order Traversal II Python3 43 ms
108 Convert Sorted Array to Binary Search Tree Python3 56 ms
109 Convert Sorted List to Binary Search Tree Python3 128 ms
110 Balanced Binary Tree Python3 53 ms
111 Minimum Depth of Binary Tree Python3 564 ms
112 Path Sum Python3 35 ms
113 Path Sum II Python3 55 ms
114 Flatten Binary Tree to Linked List Python3 41 ms
116 Populating Next Right Pointers in Each Node Python3 67 ms
117 Populating Next Right Pointers in Each Node II Python3 47 ms
121 Best Time to Buy and Sell Stock Python3 886 ms
125 Valid Palindrome Python3 50 ms
129 Sum Root to Leaf Numbers Python3 39 ms
136 Single Number Python3 115 ms
141 Linked List Cycle Python3 58 ms
142 Linked List Cycle II Python3 53 ms
143 Reorder List Python3 94 ms
144 Binary Tree Preorder Traversal Python3 45 ms
145 Binary Tree Postorder Traversal Python3 36 ms
148 Sort List Python3 665 ms
150 Evaluate Reverse Polish Notation Python3 56 ms
160 Intersection of Two Linked Lists Python3 157 ms
167 Two Sum II - Input array is sorted Python3 64 ms
169 Majority Element Python3 156 ms
173 Binary Search Tree Iterator Python3 72 ms
175 Combine Two Tables MySQL 1082 ms
176 Second Highest Salary MySQL 593 ms
177 Nth Highest Salary MySQL 781 ms
178 Rank Scores MySQL 737 ms
180 Consecutive Numbers Oracle 929 ms
181 Employees Earning More Than Their Managers MySQL 632 ms
182 Duplicate Emails MySQL 653 ms
183 Customers Who Never Order MySQL 1243 ms
184 Department Highest Salary MySQL 1388 ms
185 Department Top Three Salaries MySQL 1634 ms
189 Rotate Array Python3 181 ms
196 Delete Duplicate Emails MySQL 1277 ms
197 Rising Temperature MySQL 763 ms
199 Binary Tree Right Side View Python3 33 ms
202 Happy Number Python3 38 ms
203 Remove Linked List Elements Python3 75 ms
206 Reverse Linked List Python3 41 ms
207 Course Schedule Python3 96 ms
210 Course Schedule II Python3 96 ms
217 Contains Duplicate Python3 435 ms
219 Contains Duplicate II Python3 1644 ms
222 Count Complete Tree Nodes Python3 78 ms
225 Implement Stack using Queues Python3 28 ms
226 Invert Binary Tree Python3 33 ms
227 Basic Calculator II Python3 272 ms
229 Majority Element II Python3 129 ms
230 Kth Smallest Element in a BST Python3 58 ms
232 Implement Queue using Stacks Python3 40 ms
234 Palindrome Linked List Python3 523 ms
235 Lowest Common Ancestor of a Binary Search Tree Python3 80 ms
236 Lowest Common Ancestor of a Binary Tree Python3 54 ms
242 Valid Anagram Python3 52 ms
257 Binary Tree Paths Python3 34 ms
258 Add Digits Python3 45 ms
262 Trips and Users MySQL 1105 ms
268 Missing Number Python3 119 ms
283 Move Zeroes Python3 137 ms
287 Find the Duplicate Number C++ 236 ms
316 Remove Duplicate Letters Python3 40 ms
328 Odd Even Linked List Python3 51 ms
344 Reverse String Python3 193 ms
345 Reverse Vowels of a String Python3 60 ms
347 Top K Frequent Elements Python3 97 ms
349 Intersection of Two Arrays Python3 53 ms
350 Intersection of Two Arrays II Python3 64 ms
383 Ransom Note Python3 65 ms
387 First Unique Character in a String Python3 385 ms
389 Find the Difference Python3 50 ms
392 Is Subsequence Python3 42 ms
394 Decode String Python3 28 ms
402 Remove K Digits Python3 40 ms
404 Sum of Left Leaves Python3 24 ms
437 Path Sum III Python3 928 ms
442 Find All Duplicates in an Array Python3 289 ms
445 Add Two Numbers II Python3 64 ms
449 Serialize and Deserialize BST Python3 112 ms
450 Delete Node in a BST Python3 72 ms
456 132 Pattern Python3 536 ms
485 Max Consecutive Ones Python3 313 ms
494 Target Sum Python3 217 ms
496 Next Greater Element I Python3 48 ms
501 Find Mode in Binary Search Tree Python3 61 ms
503 Next Greater Element II Python3 234 ms
508 Most Frequent Subtree Sum Python3 52 ms
511 Game Play Analysis I Oracle 885 ms
513 Find Bottom Left Tree Value Python3 44 ms
515 Find Largest Value in Each Tree Row Python3 46 ms
520 Detect Capital Python3 62 ms
530 Minimum Absolute Difference in BST Python3 56 ms
538 Convert BST to Greater Tree Python3 84 ms
541 Reverse String II Python3 42 ms
543 Diameter of Binary Tree Python3 39 ms
547 Number of Provinces Python3 196 ms
557 Reverse Words in a String III Python3 36 ms
563 Binary Tree Tilt Python3 56 ms
572 Subtree of Another Tree Python3 228 ms
577 Employee Bonus MySQL 2269 ms
579 Find Cumulative Salary of an Employee MySQL 694 ms
584 Find Customer Referee MySQL 983 ms
585 Investments in 2016 MySQL 886 ms
586 Customer Placing the Largest Number of Orders Oracle 738 ms
595 Big Countries MySQL 453 ms
596 Classes More Than 5 Students Oracle 526 ms
599 Minimum Index Sum of Two Lists Python3 312 ms
606 Construct String from Binary Tree Python3 48 ms
607 Sales Person Oracle 2918 ms
608 Tree Node Oracle 665 ms
611 Valid Triangle Number Python3 979 ms
615 Average Salary: Departments VS Company MySQL 564 ms
617 Merge Two Binary Trees Python3 74 ms
618 Students Report By Geography MySQL 417 ms
619 Biggest Single Number Oracle 614 ms
620 Not Boring Movies Oracle 510 ms
623 Add One Row to Tree Python3 52 ms
626 Exchange Seats Oracle 548 ms
627 Swap Salary Oracle 818 ms
637 Average of Levels in Binary Tree Python3 55 ms
654 Maximum Binary Tree Python3 252 ms
657 Robot Return to Origin Python3 60 ms
662 Maximum Width of Binary Tree Python3 44 ms
669 Trim a Binary Search Tree Python3 96 ms
671 Second Minimum Node In a Binary Tree Python3 24 ms
682 Baseball Game Python3 44 ms
700 Search in a Binary Search Tree Python3 76 ms
701 Insert into a Binary Search Tree Python3 120 ms
704 Binary Search Python3 205 ms
707 Design Linked List Python3 190 ms
709 To Lower Case Python3 33 ms
724 Find Pivot Index Python3 114 ms
725 Split Linked List in Parts Python3 40 ms
735 Asteroid Collision Python3 86 ms
739 Daily Temperatures Python3 1466 ms
743 Network Delay Time Python3 476 ms
744 Find Smallest Letter Greater Than Target Python3 111 ms
771 Jewels and Stones Python3 41 ms
783 Minimum Distance Between BST Nodes Python3 24 ms
785 Is Graph Bipartite? Python3 291 ms
787 Cheapest Flights Within K Stops Python3 104 ms
797 All Paths From Source to Target Python3 88 ms
804 Unique Morse Code Words Python3 32 ms
814 Binary Tree Pruning Python3 32 ms
841 Keys and Rooms Python3 64 ms
844 Backspace String Compare Python3 26 ms
856 Score of Parentheses Python3 28 ms
865 Smallest Subtree with all the Deepest Nodes Python3 44 ms
872 Leaf-Similar Trees Python3 28 ms
876 Middle of the Linked List Python3 41 ms
880 Decoded String at Index Python3 36 ms
897 Increasing Order Search Tree Python3 32 ms
907 Sum of Subarray Minimums Python3 628 ms
917 Reverse Only Letters Python3 37 ms
919 Complete Binary Tree Inserter Python3 468 ms
921 Minimum Add to Make Parentheses Valid Python3 48 ms
938 Range Sum of BST Python3 105 ms
946 Validate Stack Sequences Python3 76 ms
951 Flip Equivalent Binary Trees Python3 32 ms
958 Check Completeness of a Binary Tree Python3 36 ms
965 Univalued Binary Tree Python3 28 ms
976 Largest Perimeter Triangle Python3 206 ms
988 Smallest String Starting From Leaf Python3 72 ms
993 Cousins in Binary Tree Python3 32 ms
997 Find the Town Judge Python3 720 ms
998 Maximum Binary Tree II Python3 40 ms
1003 Check If Word Is Valid After Substitutions Python3 67 ms
1008 Construct Binary Search Tree from Preorder Traversal Python3 36 ms
1021 Remove Outermost Parentheses Python3 40 ms
1022 Sum of Root To Leaf Binary Numbers Python3 48 ms
1026 Maximum Difference Between Node and Ancestor Python3 44 ms
1038 Binary Search Tree to Greater Sum Tree Python3 41 ms
1045 Customers Who Bought All Products Oracle 735 ms
1047 Remove All Adjacent Duplicates In String Python3 75 ms
1050 Actors and Directors Who Cooperated At Least Three Times Oracle 878 ms
1051 Height Checker Python3 81 ms
1068 Product Sales Analysis I MySQL 3245 ms
1081 Smallest Subsequence of Distinct Characters Python3 36 ms
1084 Sales Analysis III MySQL 1795 ms
1104 Path In Zigzag Labelled Binary Tree Python3 28 ms
1108 Defanging an IP Address Python3 42 ms
1110 Delete Nodes And Return Forest Python3 96 ms
1123 Lowest Common Ancestor of Deepest Leaves Python3 64 ms
1141 User Activity for the Past 30 Days I MySQL 820 ms
1148 Article Views I MySQL 814 ms
1158 Market Analysis I Oracle 1517 ms
1161 Maximum Level Sum of a Binary Tree Python3 245 ms
1173 Immediate Food Delivery I MySQL 1016 ms
1174 Immediate Food Delivery II MySQL 1695 ms
1179 Reformat Department Table MS SQL Server 1597 ms
1190 Reverse Substrings Between Each Pair of Parentheses Python3 40 ms
1204 Last Person to Fit in the Bus MySQL 1319 ms
1207 Unique Number of Occurrences Python3 39 ms
1209 Remove All Adjacent Duplicates in String II Python3 176 ms
1249 Minimum Remove to Make Valid Parentheses Python3 152 ms
1251 Average Selling Price MySQL 1637 ms
1261 Find Elements in a Contaminated Binary Tree Python3 752 ms
1281 Subtract the Product and Sum of Digits of an Integer Python3 38 ms
1282 Group the People Given the Group Size They Belong To Python3 61 ms
1290 Convert Binary Number in a Linked List to Integer Python3 35 ms
1302 Deepest Leaves Sum Python3 167 ms
1305 All Elements in Two Binary Search Trees Python3 322 ms
1313 Decompress Run-Length Encoded List Python3 62 ms
1315 Sum of Nodes with Even-Valued Grandparent Python3 108 ms
1325 Delete Leaves With a Given Value Python3 48 ms
1331 Rank Transform of an Array Python3 364 ms
1339 Maximum Product of Splitted Binary Tree Python3 388 ms
1361 Validate Binary Tree Nodes Python3 304 ms
1365 How Many Numbers Are Smaller Than the Current Number Python3 93 ms
1367 Linked List in Binary Tree Python3 104 ms
1378 Replace Employee ID With The Unique Identifier MySQL 2213 ms
1379 Find a Corresponding Node of a Binary Tree in a Clone of That Tree Python3 656 ms
1381 Design a Stack With Increment Operation Python3 356 ms
1382 Balance a Binary Search Tree Python3 776 ms
1393 Capital Gain/Loss MySQL 1087 ms
1407 Top Travellers Oracle 1049 ms
1431 Kids With the Greatest Number of Candies Python3 47 ms
1436 Destination City Python3 60 ms
1441 Build an Array With Stack Operations Python3 28 ms
1448 Count Good Nodes in Binary Tree Python3 127 ms
1450 Number of Students Doing Homework at a Given Time Python3 40 ms
1457 Pseudo-Palindromic Paths in a Binary Tree Python3 864 ms
1464 Maximum Product of Two Elements in an Array Python3 52 ms
1470 Shuffle the Array Python3 51 ms
1479 Sales by Day of the Week MS SQL Server 843 ms
1480 Running Sum of 1d Array Python3 39 ms
1484 Group Sold Products By The Date MySQL 1186 ms
1486 XOR Operation in an Array Python3 33 ms
1491 Average Salary Excluding the Minimum and Maximum Salary Python3 32 ms
1492 The kth Factor of n Python3 51 ms
1512 Number of Good Pairs Python3 26 ms
1527 Patients With a Condition Oracle 585 ms
1528 Shuffle String Python3 117 ms
1530 Number of Good Leaf Nodes Pairs Python3 N/A
1541 Minimum Insertions to Balance a Parentheses String Python3 296 ms
1544 Make The String Great Python3 33 ms
1572 Matrix Diagonal Sum Python3 95 ms
1581 Customer Who Visited but Did Not Make Any Transactions MySQL 2118 ms
1587 Bank Account Summary II MySQL 1613 ms
1588 Sum of All Odd Length Subarrays Python3 73 ms
1598 Crawler Log Folder Python3 52 ms
1609 Even Odd Tree Python3 564 ms
1614 Maximum Nesting Depth of the Parentheses Python3 38 ms
1661 Average Time of Process per Machine MySQL 418 ms
1662 Check If Two String Arrays are Equivalent Python3 31 ms
1667 Fix Names in a Table Oracle 716 ms
1669 Merge In Between Linked Lists Python3 329 ms
1672 Richest Customer Wealth Python3 58 ms
1673 Find the Most Competitive Subsequence Python3 1360 ms
1678 Goal Parser Interpretation Python3 36 ms
1683 Invalid Tweets MySQL 1122 ms
1684 Count the Number of Consistent Strings Python3 210 ms
1688 Count of Matches in Tournament Python3 33 ms
1693 Daily Leads and Partners MySQL 1309 ms
1721 Swapping Nodes in a Linked List Python3 1795 ms
1729 Find Followers Count Oracle 926 ms
1732 Find the Highest Altitude Python3 44 ms
1741 Find Total Time Spent by Each Employee MySQL 1202 ms
1748 Sum of Unique Elements Python3 34 ms
1752 Check if Array Is Sorted and Rotated Python3 44 ms
1757 Recyclable and Low Fat Products MySQL 1036 ms
1767 Find the Subtasks That Did Not Execute MS SQL Server 2118 ms
1795 Rearrange Products Table MySQL 1167 ms
1816 Truncate Sentence Python3 30 ms
1832 Check if the Sentence Is Pangram Python3 38 ms
1833 Maximum Ice Cream Bars C++ 156 ms
1859 Sorting the Sentence Python3 29 ms
1873 Calculate Special Bonus Oracle 775 ms
1890 The Latest Login in 2020 Oracle 1070 ms
1907 Count Salary Categories MySQL 3138 ms
1913 Maximum Product Difference Between Two Pairs Python3 163 ms
1920 Build Array from Permutation Python3 101 ms
1929 Concatenation of Array Python3 78 ms
1934 Confirmation Rate MySQL 1685 ms
1965 Employees With Missing Information Oracle 760 ms
1967 Number of Strings That Appear as Substrings in Word Python3 42 ms
1978 Employees Whose Manager Left the Company Oracle 555 ms
1991 Find the Middle Index in Array Python3 45 ms
2006 Count Number of Pairs With Absolute Difference K Python3 61 ms
2011 Final Value of Variable After Performing Operations Python3 59 ms
2016 Maximum Difference Between Increasing Elements Python3 39 ms
2042 Check if Numbers Are Ascending in a Sentence Python3 37 ms
2082 The Number of Rich Customers MySQL 1255 ms
2085 Count Common Words With One Occurrence Python3 74 ms
2089 Find Target Indices After Sorting Array Python3 48 ms
2095 Delete the Middle Node of a Linked List Python3 1236 ms
2108 Find First Palindromic String in the Array Python3 102 ms
2109 Adding Spaces to a String Python3 698 ms
2114 Maximum Number of Words Found in Sentences Python3 47 ms
2119 A Number After a Double Reversal Python3 34 ms
2124 Check if All A's Appears Before All B's Python3 29 ms
2126 Destroying Asteroids Python3 1085 ms
2129 Capitalize the Title Python3 65 ms
2130 Maximum Twin Sum of a Linked List Python3 647 ms
2149 Rearrange Array Elements by Sign Python3 1189 ms
2180 Count Integers With Even Digit Sum Python3 33 ms
2181 Merge Nodes in Between Zeros Python3 1020 ms
2185 Counting Words With a Given Prefix Python3 49 ms
2215 Find the Difference of Two Arrays Python3 163 ms
2235 Add Two Integers Python3 39 ms
2236 Root Equals Sum of Children Python3 36 ms
2351 First Letter to Appear Twice Python3 34 ms
2356 Number of Unique Subjects Taught by Each Teacher MySQL 1068 ms
2357 Make Array Zero by Subtracting Equal Amounts Python3 42 ms
2362 Generate the Invoice Oracle 1367 ms
2367 Number of Arithmetic Triplets Python3 47 ms
2390 Removing Stars From a String Python3 233 ms
2413 Smallest Even Multiple Python3 40 ms
2418 Sort the People Python3 114 ms
2455 Average Value of Even Numbers That Are Divisible by Three Python3 79 ms
2460 Apply Operations to an Array Python3 55 ms
2469 Convert the Temperature Python3 40 ms
2485 Find the Pivot Integer Python3 54 ms
2523 Closest Prime Numbers in Range Python3 3025 ms
2529 Maximum Count of Positive Integer and Negative Integer Python3 131 ms
2540 Minimum Common Value Python3 381 ms
2544 Alternating Digit Sum Python3 23 ms
2545 Sort the Students by Their Kth Score Python3 373 ms
2549 Count Distinct Numbers on Board Python3 44 ms
2553 Separate the Digits in an Array Python3 80 ms
2574 Left and Right Sum Differences Python3 64 ms
2652 Sum Multiples Python3 75 ms
2678 Number of Senior Citizens Python3 50 ms
2769 Find the Maximum Achievable Number Python3 43 ms
2798 Number of Employees Who Met the Target Python3 38 ms
2807 Insert Greatest Common Divisors in Linked List Python3 70 ms
2810 Faulty Keyboard Python3 46 ms
2816 Double a Number Represented as a Linked List Python3 490 ms
2828 Check if a String Is an Acronym of Words Python3 60 ms
2878 Get the Size of a DataFrame Pandas 542 ms
2879 Display the First Three Rows Pandas 646 ms
2881 Create a New Column Pandas 464 ms
2884 Modify Columns Pandas 575 ms
2888 Reshape Data: Concatenate Pandas 469 ms
2942 Find Words Containing Character Python3 59 ms
3028 Ant on the Boundary Python3 49 ms
3057 Employees Project Allocation MySQL 1865 ms
3061 Calculate Trapping Rain Water MySQL 853 ms

About

This repo consists of codes that I practiced in my free time to build up my problem solving.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published