Skip to content

MeSabya/LeetCodeProgramsInPython

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

483 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Templates From Leetcode

  1. 𝐒𝐮𝐛𝐬𝐭𝐫𝐢𝐧𝐠 𝐏𝐫𝐨𝐛𝐥𝐞𝐦 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬: https://lnkd.in/giASrwds

  2. 𝐒𝐥𝐢𝐝𝐢𝐧𝐠 𝐖𝐢𝐧𝐝𝐨𝐰 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬: https://lnkd.in/gjatQ5pK

  3. 𝐓𝐰𝐨 𝐏𝐨𝐢𝐧𝐭𝐞𝐫𝐬 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬: https://lnkd.in/gBfWgHYe

  4. 𝐁𝐚𝐜𝐤𝐭𝐫𝐚𝐜𝐤𝐢𝐧𝐠 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬: https://lnkd.in/g9csxVa4

  5. 𝐃𝐲𝐧𝐚𝐦𝐢𝐜 𝐏𝐫𝐨𝐠𝐫𝐚𝐦𝐦𝐢𝐧𝐠 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬 1: https://lnkd.in/gbpRU46g

  6. 𝐃𝐲𝐧𝐚𝐦𝐢𝐜 𝐏𝐫𝐨𝐠𝐫𝐚𝐦𝐦𝐢𝐧𝐠 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬 2: https://lnkd.in/gcnBActT

  7. 𝐁𝐢𝐧𝐚𝐫𝐲 𝐒𝐞𝐚𝐫𝐜𝐡 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬: https://lnkd.in/gKEm_qUK

  8. 𝐁𝐚𝐜𝐤𝐭𝐫𝐚𝐜𝐤𝐢𝐧𝐠 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬: https://lnkd.in/gVkQX5vA

  9. 𝐓𝐫𝐞𝐞 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬: https://lnkd.in/gKja_D5H

  10. 𝐆𝐫𝐚𝐩𝐡 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬: https://lnkd.in/gKE6w7Jb

  11. 𝐌𝐨𝐧𝐨𝐭𝐨𝐧𝐢𝐜 𝐒𝐭𝐚𝐜𝐤 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬: https://lnkd.in/gdYahWVN

  12. 𝐁𝐢𝐭 𝐌𝐚𝐧𝐢𝐩𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬: https://lnkd.in/gmMMST5J

  13. 𝐒𝐭𝐫𝐢𝐧𝐠 𝐐𝐮𝐞𝐬𝐭𝐢𝐨𝐧 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬: https://lnkd.in/gkNvEi8j

  14. 𝐃𝐅𝐒 + 𝐁𝐅𝐒 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬 (1): https://lnkd.in/gPgpsgaQ

  15. 𝐃𝐅𝐒 + 𝐁𝐅𝐒 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬 (2): https://lnkd.in/gd4ekfQe

  16. 14 𝐂𝐨𝐝𝐢𝐧𝐠 𝐈𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐏𝐚𝐭𝐭𝐞𝐫𝐧𝐬: https://lnkd.in/gMZJVkFf

References:

  1. 30-days-interview-preparation-plan-200-best-coding-questions-and-behavioural-interviews
  2. List of Leetcode Programs
  3. some-patterns-dfs
  4. top-50-dynamic-programming-practice-problems
  5. top-problems-on-sliding-window-technique
  6. Graph Related Problems
  7. BackTrack
  8. Two Pointers

Behavioral Based Job Interview Questions1

Behavioral Based Job Interview Questions2

Greedy Problems

  1. Boats to Save People
  2. Gas Station

Design Questions

  1. DesignCircularDeque
  2. HashMap
  3. LoggerRateLimiter
  4. SeatReservationManager
  5. SnakeGameDesign
  6. Time Based Key-Value Store
  7. Tweeter

Modified Binary Search

  1. List of Binary search Problems
  2. Find Right Interval
  3. time-based-key-value-store

Linked List Problem

  1. odd-even-linked-list
  2. reverse-nodes-in-k-group
  3. linked-list-cycle-origin
  4. design-browser-history
  5. partition-list
  6. Sort a list
  7. reorder-list
  8. add-two-numbers-ii as linked list
  9. remove-duplicates-from-sorted-list-ii
  10. convert-binary-number-in-a-linked-list-to-integer

Backtracking

  1. Sudoku Solver
  2. restore-ip-addresses

Array Problems

  1. First Missing Positive
  2. Rotate Image
  3. Spiral Matrix
  4. Set Matrix Zeroes
  5. Word Search
  6. Longest Consecutive Sequence
  7. Single Number
  8. Contains Duplicate
  9. product-of-array-except-self
  10. Missing Number
  11. Find the Duplicate Number
  12. Find All Duplicates in an Array
  13. Find All Numbers Disappeared in an Array
  14. Circular Array Loop
  15. Shortest Unsorted Continuous Subarray
  16. Number of Matching Subsequences
  17. MaximumDifferenceBetweenTwoIndices
  18. Sum of All Odd Length Subarrays
  19. Chocolate Distribution Problem
  20. Maximum Sum Circular subarray
  21. Maximum Product Sub Array
  22. Kadanes Algo
  23. rank-teams-by-votes
  24. Sort in Wave form
  25. gas-station
  26. maximum-difference-between-two-elements
  27. Kadanes algo
  28. integer-to-roman 29.longest-substring-with-at-least-k-repeating-characters
  29. partition-labels
  30. can-place-flowers
  31. Fisher–Yates shuffle Algorithm

String Problems

  1. Count Pallindromes
  2. String Interleaving
  3. next-greater-element-iii
  4. Next higher Palindrome Same digits
  5. count-number-of-distinct-substring-in-a-string
  6. reverse-words-in-a-string
  7. Write a Code to check whether one string is a rotation of another
  8. Write a Program to check whether a string is a valid shuffle of two strings or not
  9. Count and Say problem
  10. Write a program to find the longest Palindrome in a string.[ Longest palindromic Substring]
  11. Find Longest Recurring Subsequence in String
  12. Print all Subsequences of a string.
  13. Print all the permutations of the given string
  14. Split the Binary string into two substring with equal 0’s and 1’s
  15. Word Wrap Problem [VERY IMP].
  16. EDIT Distance [Very Imp]
  17. Find next greater number with same set of digits. [Very Very IMP]
  18. Balanced Parenthesis problem.[Imp]
  19. Word break Problem
  20. Rabin Karp Algo
  21. KMP Algo
  22. Convert a Sentence into its equivalent mobile numeric keypad sequence.
  23. Minimum number of bracket reversals needed to make an expression balanced.
  24. Count All Palindromic Subsequence in a given String.
  25. Count of number of given string in 2D character array
  26. Search a Word in a 2D Grid of characters.
  27. Converting Roman Numerals to Decimal
  28. Longest Common Prefix
  29. Number of flips to make binary string alternate
  30. Find the first repeated word in string.
  31. Minimum number of swaps for bracket balancing.
  32. Find the longest common subsequence between two strings.
  33. Program to generate all possible valid IP addresses from given string.
  34. Write a program tofind the smallest window that contains all characters of string itself.
  35. Rearrange characters in a string such that no two adjacent are same
  36. Minimum characters to be added at front to make string palindrome
  37. Given a sequence of words, print all anagrams together
  38. Find the smallest window in a string containing all characters of another string
  39. remove-all-adjacent-duplicates-in-string-ii
  40. String matching where one string contains wildcard characters
  41. Function to find Number of customers who could not get a computer
  42. Transform One String to Another using Minimum Number of Given Operation
  43. Check if two given strings are isomorphic to each other
  44. Recursively print all sentences that can be formed from list of word lists
  45. longest-duplicate-substring
  46. MyAtoi
  47. Longest Substring with At Least K Repeating Characters

Stack Problems

  1. Remove K Digits
  2. Remove Duplicate Letters
  3. Smallest Subsequence of Distinct Characters
  4. Decode String
  5. Backspace String Compare
  6. Remove All Adjacent Duplicates In String
  7. Minimum Add to Make Parentheses Valid
  8. longest-valid-parentheses
  9. Palindrome Linked List
  10. asteroid-collision
  11. sort-a-stack-using-recursion
  12. reverse-a-stack-using-recursion
  13. min-stack Design
  14. monotonic-stack
  15. score-of-parentheses

Solving Basic Calculator I, II, III on leetcode

  1. Solving Basic Calculator I, II, III on leetcode

Prefix Sum

  1. range-sum-query-immutable
  2. Continuous Subarray Sum 3.Subarray sum Equals to K 4.continuous-subarray-sum-divisible-by-k

Sliding Window

  1. Longest Substring with K Distinct Characters
  2. Fruits into Baskets
  3. Permutation in a String
  4. longest-substring-without-repeating-characters
  5. minimum-window-substring
  6. Minimum Size Subarray Sum
  7. Longest Subarray with Ones after Replacement
  8. sliding-window-maximum
  9. grumpy-bookstore-owner
  10. Maximum Points You Can Obtain from Cards

Two Pointers

  1. Squaring a Sorted Array
  2. Dutch National Flag Problem
  3. Minimum Window Sort
  4. ContainerWithMostWater
  5. TrappingRainWater
  6. SubArraysProductLessThanTarget
  7. Sort Colours
  8. count-number-of-teams
  9. sort-array-by-parity

Fast & Slow Pointers

  1. Middle of the LinkedList
  2. Happy Number
  3. Cycle in a Circular Array

Merge Intervals

  1. Intervals Intersection
  2. Conflicting Appointments
  3. Minimum Meeting Rooms
  4. Maximum CPU Load (hard)

Matrix Problems

  1. Print matrix in spiral order
  2. Create a spiral matrix from a given array
  3. In-place rotate matrix by 180 degrees
  4. In-place rotate matrix by 90 degrees in a clockwise direction
  5. Find the largest square submatrix which is surrounded by all 1’s
  6. Find all common elements present in each row of a matrix
  7. Find duplicate rows in a binary matrix
  8. Sort Matrix Diagonally
  9. Search an element in a matrix
  10. Find median in a row wise sorted matrix
  11. Find row with maximum no. of 1's
  12. Print elements in sorted order using row-column wise sorted matrix
  13. Maximum size rectangle
  14. Find a specific pair in matrix
  15. Kth smallest element in a row-cpumn wise sorted matrix
  16. maximal-square

Binary Search Trees

  1. Binary Search Tree Iterator
  2. Kth Smallest Element in a BST
  3. Lowest Common Ancestor of a Binary Search Tree
  4. Validate Binary Search Tree
  5. range-sum-of-bst
  6. convert-bst-to-greater-tree
  7. Delete a Node in BST

Tree Problems

Tree Breadth-First Search

  1. Binary Tree Level Order Traversal
  2. Minimum Depth of a Binary Tree
  3. Connect Level Order Siblings
  4. DeleteNodesAndReturnForest
  5. all-nodes-distance-k-in-binary-tree
  6. Check completeness of a Btree
  7. invert-binary-tree
  8. the distance of the nearest 0 for each cell

Tree Depth First Search

Easy

  1. symmetric-tree
  2. maximum-depth-of-binary-tree
  3. invert-binary-tree
  4. diameter-of-binary-tree
  5. merge-two-binary-trees
  6. minimum-depth-of-binary-tree
  7. path-sum
  8. subtree-of-another-tree
  9. balanced-binary-tree 10.sum-of-root-to-leaf-binary-numbers 11.kth-smallest-element-in-a-bst 12.binary-tree-paths/ 13.LCA in BST 14.construct-binary-search-tree-from-preorder-traversal 15.LCA in BTree 16.count-good-nodes-in-binary-tree ✴️ 17.longest-zigzag-path-in-a-binary-tree ✳️

Medium

Reference

https://igotanoffer.com/blogs/tech/tree-interview-questions

Heap Problems

  1. maximum-profit-in-job-scheduling
  2. design-twitter
  3. sliding-window-maximum

Two Heaps

  1. Find the Median of a Number Stream
  2. Next Interval
  3. Sliding window median

Subsets

  1. String Permutations by changing case
  2. Permutations of a string
  3. Generate Parentheses
  4. subsets with duplicates
  5. letter-combinations-of-a-phone-number
  6. combination-sum-ii
  7. Combination Sum IV
  8. combination-sum-iii
  9. combination-sum

Bitwise XOR

Top ‘K’ Elements

K-way Merge

  1. kth-smallest-element-in-a-sorted-matrix
  2. smallest-range-covering-elements-from-k-lists

Kadanes Algo

Explanation

  1. Kadanes Algo

Generic DP

  1. decode-ways
  2. maximum-length-of-repeated-subarray

Jump Game

  1. jump-game-ii
  2. jump Game- III

0/1 Knapsack

  1. SubsetProblemsList

Unbounded Knapsack

  1. UnboundedKSList
  2. combination-sum combination-sum

Fibonacci Number Pattern

  1. house-robber
  2. house-robber in circle
  3. house rubber in tree

DP Problems Palindromic Subsequence

  1. palindrome-partitioning

Longest string Problems

  1. longest-common-subsequence
  2. longest-common-substring

Longest Increasing Subsequence

  1. LIS LIS using Bsearch
  2. russian-doll-envelopes
  3. Minimum Deletions to Make a Sequence Sorted

Stock buy and sell problems

  1. best-time-to-buy-and-sell-stock-ii
  2. Best Time to Buy and Sell Stock with Transaction Fee
  3. Best Time to Buy and Sell Stock with Transaction Fee Sol2
  4. [https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/]

Graph Problems

  1. Detect-cycle-in-a-directed-graph
  2. Max-area-of-island
  3. Number-of-provinces
  4. Number of Islands
  5. rotting-oranges
  6. Shortest Path in a Binary Matrix
  7. find-longest-possible-route-matrix
  8. Find the total number of unique paths in a maze from source to destination
  9. UniquePaths
  10. Detect cycle in an undirected graph
  11. Shortest path in a weighted graph
  12. Shortest path in a unweighted graph
  13. path-with-maximum-gold
  14. unique-paths- with obstacle
  15. word-break
  16. Shortest Bridge 🔯
  17. keys-and-rooms
  18. number-of-provinces

Dijkistras Algorithm

  1. Dijkistras Algorithm
  2. CheapestFlightsWithinKStops

Topological Sort

  1. course-schedule
  2. course-schedule-ii
  3. All Tasks Scheduling order
  4. Topological Sort Basics
  5. Detect Cycle in a Directed Graph

Union Find

  1. UnionFind Explanation
  2. Detect Cycle in an Undirected Graph
  3. Redundant Connection
  4. Number-of-operations-to-make-network-connected
  5. Number of Provinces

Trie

  1. implement-trie-prefix-tree
  2. map-sum-pairs
  3. count distinct substring
  4. longest-common-prefix
  5. replace words in C++

Generic DFS

  1. path-with-maximum-gold
  2. Robot Bounded In Circle
  3. surrounded-regions
  4. Minimum Path Sum
  5. longest-string-chain

Generic BFS

  1. longest-string-chain

BackTracking

  1. Partition to K Equal Sum Subsets

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages