Skip to content

prabhakar97/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 

Repository files navigation

Introduction

These are my solutions to Leetcode problems in Java 8. I have tried to keep the solutions clear and concise, but there might be opportunities for improvement. In that case, just send me a PR.

Problems tagged Easy

Problem ID Problem Solution Space Complexity Time Complexity Runtime (ms)
832 Flipping an image Click O(m*n) O(1) 8
824 Goat Latin Click O(n) O(1) 95
830 Positions of Large Groups Click O(n) O(1) 19
821 Shortest Distance to a Character Click O(n) O(1) 9
819 Most Common Word Click O(n) O(n) 84
811 Subdomain Visit Count Click O(n) O(n) 116
806 Number of Lines to Write String Click O(n) O(1) 3
804 Unique Morse Code Words Click O(n) O(1) 11
796 Rotate String Click O(n) O(1) 4
788 Rotated Digits Click O(2^N * N) O(1) 214
784 Letter Case Permutation Click O(2 ^ n) O(2 ^ n) for returning, else O(1) 97
783 Minimum Distance Between BST Nodes Click O(n) O(1) 5
771 Jewels and stones Click O(n) O(1) 19
695 Max Area of Island Click O(m * n) O(m * n) 37
203 Remove linked list elements Click O(n) O(1) 7
122 Best Time to Buy and Sell Stock II Click O(n) O(1) 2
121 Best Time to Buy and Sell Stock Click O(n) O(1) 1
111 Minimum Depth of Binary Tree Click O(n) O(1) 0
20 Valid Parentheses Click O(n) O(1) 58

Problems tagged Medium

Problem ID Problem Solution Space Complexity Time Complexity Runtime (ms)
799 Champagne Tower Click O(m * n) O(m * n) 29
791 Custom Sort String Click O(n log n) O(1) 92
785 Is Graph Bipartite? Click O(V+E) O(V) 9
779 k-th-symbol-in-grammar Click O(n) O(1) 5
769 Max Chunks to Make Sorted Click O(n) O(1) 4
767 Reorganize String Click O(n) O(1) 11
764 Largest Plus Sign Click O(N ^ 2) O(N ^ 2) 162
763 Partition Labels Click O(n) O(1) 13
756 Pyramid Transition Matrix Click Exponential O(n) 28
547 Friend Circles Click O(n log n) O(n) 13
449 Serialize and Deserialize BST Click O(n) O(n) 110
332 Reconstruct Itinerary Click O(n^2) O(n) 13
207 Course Schedule Click O(V + E) O(V) 10
200 Number of Islands Click O(m * n) O(m * n) 7
130 Surrounded Regions Click O(m * n) O(m * n) 6
127 Word Ladder Click O(n) O(n) 459
107 Binary Tree Level Order Traversal II Click O(n) O(n) 98
103 Binary Tree Zigzag Level Order Traversal Click O(n) O(n) 73
102 Binary Tree Level Order Traversal Click O(n) O(n) 66
100 Same Tree Click O(n) O(1) 3
94 Binary Tree Inorder Traversal Click O(n) O(n) 0
64 Minimum Path Sum Click O(m * n) O(m * n) 8
63 Unique Paths II Click O(m * n) O(m * n) 1
62 Unique Paths Click O(m * n) O(m * n) 1
17 Letter Combinations of a Phone Number Click O(n) O(1) 46
3 Longest Substring Without Repeating Characters Click O(n) O(n) 35
2 Add Two Numbers Click O(n) O(1) 60

Problems tagged Hard

Problem ID Problem Solution Space Complexity Time Complexity Runtime (ms)
765 Couples Holding Hands Click O(n) O(n) 5
297 Serialize and Deserialize Binary Tree Click O(n) O(n) 17
72 Edit Distance Click O(m * n) O(m * n) 14
23 Merge k Sorted Lists Click O(n) O(1) 14

About

Keep calm and solve leetcode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages