This repository contains solutions to the Blind 75 LeetCode questions. The Blind 75 list is a curated collection of 75 LeetCode questions that are frequently asked in technical interviews at major tech companies. These questions cover a wide range of topics, including arrays, strings, linked lists, binary trees, dynamic programming, and more.
The Blind 75 LeetCode Questions list is an invaluable resource for anyone preparing for technical interviews or looking to improve their problem-solving skills. By solving these questions and understanding their solutions, you can gain a deeper understanding of common algorithms and data structures used in software development.
-
Given an array of integer nums and an integer target, return indices of the two numbers such that they add up to the target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order.
Example:-
Input: nums = [ 2, 7, 11, 15 ], target = 9
Output: [ 0, 1 ]
Explanation: Because nums[ 0 ] + nums[ 1 ] == 9, we return [ 0, 1 ].Here we have an array, nums = [ 1, 8, 2, 15, 5 ], target = 13
Step 1 -> 13 - 1 = 12, check 12 exists or not in nums -> In this case not exits
Step 2 -> 13 - 8 = 5, check 5 exists or not in numbs -> In this case exits.
Step 3 -> Return [1, 4] Time complexity is O(n2)Here we have an array, nums = [1, 8, 2, 15, 5], target = 13 Step 1 -> Sort the array, nums = [1, 2, 5, 8, 15] Step 2 -> 13 - 1 = 12 -> Do binary search on nums -> Check 12 exit or not Step 3 -> 13 - 8 = 5 -> Do binary search on nums -> Check 5 exit or not -> Exiting Step 4 -> Return [1, 4] Time Complexity in 0(nLogn) because logn for sorting
Here we have an array, nums = [1, 8, 2, 15, 5], target = 13
Step 1 -> Create a hashMap to store value and indexKey Value Step 2:- 13 - 1 = 12 -> Check 12, exists or not in this hashMap -> Not exits Store the value and index in hashMap
Key Value 1 0 Step 3:- 13 - 8 = 5 -> Check 5, exists or not in this hasMap -> Not exists Store the value and index in hashMap
Key Value 1 0 8 1 Step 4: 13 - 2 = Check 11, exists or not in this hasMap -> Not exists Store the value and index in hashMap
Key Value 1 0 8 1 2 2 Step 5: 13 - 15 = Check -2, exists or not in this hasMap -> Not exists Store the value and index in hashMap
Key Value 1 0 8 1 2 2 15 3 Step 6: 13 - 5 = Check 8, exists or not in this hasMap -> exists
Key Value 1 0 8 1 2 2 15 3 Return the index of 8 that is 1, and return the index of 5 that is 4
Return [1, 4]
Time Complexity O(n)
Space Complexity O(n)
Solution:- TwoSum
- Climbing Stairs
- Coin Change
- Longest Increasing Subsequence
- Longest Common Subsequence
- Word Break Problem
- Combination Sum
- House Robber
- House Robber II
- Decode Ways
- Unique Paths
- Jump Game
- Clone Graph
- Course Schedule
- Pacific Atlantic Water Flow
- Number of Islands
- Longest Consecutive Sequence
- Alien Dictionary (Leetcode Premium)
- Graph Valid Tree (Leetcode Premium)
- Number of Connected Components in an Undirected Graph (Leetcode Premium)
- Insert Interval
- Merge Intervals
- Non-overlapping Intervals
- Meeting Rooms (Leetcode Premium)
- Meeting Rooms II (Leetcode Premium)
- Reverse a Linked List
- Detect Cycle in a Linked List
- Merge Two Sorted Lists
- Merge K Sorted Lists
- Remove Nth Node From End Of List
- Reorder List
- Longest Substring Without Repeating Characters
- Longest Repeating Character Replacement
- Minimum Window Substring
- Valid Anagram
- Group Anagrams
- Valid Parentheses
- Valid Palindrome
- Longest Palindromic Substring
- Palindromic Substrings
- Encode and Decode Strings (Leetcode Premium)
- Maximum Depth of Binary Tree
- Same Tree
- Invert/Flip Binary Tree
- Binary Tree Maximum Path Sum
- Binary Tree Level Order Traversal
- Serialize and Deserialize Binary Tree
- Subtree of Another Tree
- Construct Binary Tree from Preorder and Inorder Traversal
- Validate Binary Search Tree
- Kth Smallest Element in a BST
- Lowest Common Ancestor of BST
- Implement Trie (Prefix Tree)
- Add and Search Word
- Word Search II
Special thanks to the creators of the Blind 75 LeetCode Questions list for compiling such a comprehensive resource for interview preparation.