Skip to content

shyakdas/Blind75-Kotlin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blind 75 LeetCode Questions

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.

Introduction

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.

Blind 75 Questions and Solutions

Array

  1. Two Sum

    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 ].

    Solution 1:- Brute Force

    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)

    Solution 2:-

    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

    Solution 3:-

    Here we have an array, nums = [1, 8, 2, 15, 5], target = 13
    Step 1 -> Create a hashMap to store value and index

    Key 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

  2. Best Time to Buy and Sell Stock

  3. Contains Duplicate

  4. Product of Array Except Self

  5. Maximum Subarray

  6. Maximum Product Subarray

  7. Find Minimum in Rotated Sorted Array

  8. Search in Rotated Sorted Array

  9. 3 Sum

  10. Container With Most Water

Binary

  1. Sum of Two Integers
  2. Number of 1 Bits
  3. Counting Bits
  4. Missing Number
  5. Reverse Bits

Dynamic Programming

  1. Climbing Stairs
  2. Coin Change
  3. Longest Increasing Subsequence
  4. Longest Common Subsequence
  5. Word Break Problem
  6. Combination Sum
  7. House Robber
  8. House Robber II
  9. Decode Ways
  10. Unique Paths
  11. Jump Game

Graph

  1. Clone Graph
  2. Course Schedule
  3. Pacific Atlantic Water Flow
  4. Number of Islands
  5. Longest Consecutive Sequence
  6. Alien Dictionary (Leetcode Premium)
  7. Graph Valid Tree (Leetcode Premium)
  8. Number of Connected Components in an Undirected Graph (Leetcode Premium)

Interval

  1. Insert Interval
  2. Merge Intervals
  3. Non-overlapping Intervals
  4. Meeting Rooms (Leetcode Premium)
  5. Meeting Rooms II (Leetcode Premium)

Linked List

  1. Reverse a Linked List
  2. Detect Cycle in a Linked List
  3. Merge Two Sorted Lists
  4. Merge K Sorted Lists
  5. Remove Nth Node From End Of List
  6. Reorder List

Matrix

  1. Set Matrix Zeroes
  2. Spiral Matrix
  3. Rotate Image
  4. Word Search

String

  1. Longest Substring Without Repeating Characters
  2. Longest Repeating Character Replacement
  3. Minimum Window Substring
  4. Valid Anagram
  5. Group Anagrams
  6. Valid Parentheses
  7. Valid Palindrome
  8. Longest Palindromic Substring
  9. Palindromic Substrings
  10. Encode and Decode Strings (Leetcode Premium)

Tree

  1. Maximum Depth of Binary Tree
  2. Same Tree
  3. Invert/Flip Binary Tree
  4. Binary Tree Maximum Path Sum
  5. Binary Tree Level Order Traversal
  6. Serialize and Deserialize Binary Tree
  7. Subtree of Another Tree
  8. Construct Binary Tree from Preorder and Inorder Traversal
  9. Validate Binary Search Tree
  10. Kth Smallest Element in a BST
  11. Lowest Common Ancestor of BST
  12. Implement Trie (Prefix Tree)
  13. Add and Search Word
  14. Word Search II

Heap

  1. Merge K Sorted Lists
  2. Top K Frequent Elements
  3. Find Median from Data Stream

Contribution Guidelines

Contributions to this repository are welcome! If you have a new solution to add or want to improve an existing one, feel free to submit a pull request. Please follow these guidelines when contributing:

  • Ensure that your solution is well-documented and easy to understand.
  • Include explanations of your approach and any relevant insights.
  • Add the problem description and any additional context in the README file.
  • Follow the coding style and conventions used in the repository.

Acknowledgments

Special thanks to the creators of the Blind 75 LeetCode Questions list for compiling such a comprehensive resource for interview preparation.

About

Solving the Blind 75 Code problems in KOtlin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages