Skip to content

surajr/CodingInterview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 

Repository files navigation

Coding Interview

I just started adding problems. Stay tuned for 10 days to get more problems. 07/31 - I'm back. I'll start working on this from now.

Why you should follow this repository?

As a student I solved many leetcode problems but unable to identify the most efficient solution and this repo will help you with explanation.

Often careercup contains buggy code and most inefficient algorithms. I try to add an effcient one with explanation in my own words.

Feel free to add issues, comment and pull request.

Algorithms

Bit Manipulation

Website Title Solution Time Space Difficulty Note
Careercup Permutation Casewise Java | Python O(2^n) O(1) Medium
Leetcode 461. Hamming Distance Java | Python O(n) O(1) Easy
Leetcode 338. Counting Bits Java | Python O(nk) O(n) Medium

Arrays

Website Title Solution Time Space Difficulty Note
Leetcode 605. Can Place Flowers Java | Python O(n) O(1) Easy
Leetcode 643. Maximum Average Subarray I Java | Python O(n) O(1) Easy
Leetcode 628. Maximum Product of Three Numbers Java | Python O(n) O(1) Easy
Leetcode 605. Can Place Flowers Java | Python O(n) O(1) Easy
Leetcode 611. Valid Triangle Number Java | Python O(n) O(1) Easy
Leetcode 561. Array Partition I Java | Python O(nlogn) O(1) Easy
Leetcode 611. Valid Triangle Number Java | Python O() O() Medium
Leetcode 66. Plus One Java | Python O(n) O(1) Easy
Leetcode 88. Merge Sorted Array Java | Python O(n) O(1) Easy

Strings

Website Title Solution Time Space Difficulty Note
Leetcode 557. Reverse Words in a String III Java | Python O(n) O(1) Easy
Leetcode 387. First Unique Character in a String Java | Python O(n) O(n) Easy
Leetcode 647. Palindromic Substrings Java | Python O(n^2) O(1) Easy
Leetcode 500. Keyboard Row Java | Python O(n) O(1) Easy
Leetcode 293. Flip Game Java | Python O(n) O(1) Easy
Leetcode 521. Longest Uncommon Subsequence I Java | Python O(n) O(1) Easy
Leetcode 537. Complex Number Multiplication Java | Python O(n) O(1) Medium
Leetcode 168. Excel Sheet Column Title Java | Python O(n) O(1) Easy

HashMap

Website Title Solution Time Space Difficulty Note
Leetcode 1. Two Sum Java | Python O(n) O(n) Easy
Leetcode 359. Logger Rate Limiter Java | Python O(n) O(n) Easy
Leetcode 535. Encode and Decode TinyURL Java | Python O(n) O(1) Medium
Leetcode 266. Palindrome Permutation Java | Python O(n) O(1) Easy
Leetcode 525. Contiguous Array Java | Python O( ) O( ) Medium

Trees

Website Title Solution Time Space Difficulty Note
Leetcode 653. Two Sum IV - Input is a BST Java | Python O(n) O(n) Easy
Leetcode 617. Merge Two Binary Trees Java | Python O(mn) O(1) Easy
Leetcode 637. Average of Levels in Binary Tree Java | Python O(n) O(1) Easy
Leetcode 663. Equal Tree Partition Java | Python Medium
Leetcode 623. Add One Row to Tree Java | Python Medium
Leetcode 662. Maximum Width of Binary Tree Java | Python O(n) O(d) Medium
Leetcode 606. Construct String from Binary Tree Java | Python O(n) O(1) Easy
Leetcode 101. Symmetric Tree Java | Python O(n) O(1) Easy
Leetcode 111. Minimum Depth of Binary Tree Java | Python O(n) O(1) Easy
Leetcode 110. Balanced Binary Tree Java | Python O(n) O(1) Easy

Dynamic Programming

Website Title Solution Time Space Difficulty Note
Leetcode 53. Maximum Sum Subarray Java | Python O(n) O(1) Easy
Leetcode 152. Maximum Product Subarray Java | Python O(n) O(1) Medium
Leetcode 628. Maximum Product of Three Numbers Java | Python O(n) O(1) Easy
Leetcode 62. Unique Paths Java | Python O(m*n) O(m+n) Easy
Leetcode 62. Unique Paths Java | Python O(n) O(1) Easy
Leetcode 264. Ugly Number II Java | Python O(n) O(1) Easy
Leetcode 70. Climbing Stairs Java | Python O(n) O(1) Easy

Recursion

Website Title Solution Time Space Difficulty Note
Leetcode 654. Maximum Binary Tree Java | Python O(n log n) O(n) Easy
Leetcode 50. Pow(x, n) Java | Python O() O(n) Medium

Recursion

Website Title Solution Time Space Difficulty Note
Leetcode 339. Nested List Weight Sum Java | Python O( ) O( ) Easy

Heaps

Website Title Solution Time Space Difficulty Note
Leetcode 621. Task Scheduler Java | Python O(n) O(n) Medium

Binary Search

Website Title Solution Time Space Difficulty Note
Leetcode 278. First Bad Version Java | Python O(logn) O(1) Easy

Stack

Website Title Solution Time Space Difficulty Note
Leetcode 155. Min Stack Java | Python O(n) O(1) Easy

Queue

Website Title Solution Time Space Difficulty Note
Leetcode 225. Implement Stack using Queues Java | Python O(n) O(1) Easy

LinkedList

Website Title Solution Time Space Difficulty Note
Leetcode 328. Odd Even Linked List Java | Python O(n) O(1) Medium
Leetcode 23. Merge k Sorted Lists Java | Python O(n logk) O(1) Medium
Leetcode 83. Remove Duplicates from Sorted List Java | Python O(n) O(1) Easy

TwoPointers

Website Title Solution Time Space Difficulty Note
Leetcode 680. Valid Palindrome II Java | Python O(n) O(1) Easy

BFS

Website Title Solution Time Space Difficulty Note
Leetcode 690. Employee Importance Java | Python O(v+e) O(1) Easy

Releases

No releases published

Packages

 
 
 

Contributors

Languages