/Leetcode_Playground

Solutions to problems in cracking the coding interview and leetcode

Primary LanguagePython

Leetcode Playground

Solutions to problems in cracking the coding interview and Leetcode problems

Problems

  1. Given a non-empty array of integers, every element appears twice except for one. Find that single one.
  2. Happy Number
  3. Maximum sum continous array O(n).
  4. Move all zero's to end of array without extra space
  5. Best Time to Buy and Sell Stock II (Three approaches).
  6. Group Anagrams
  7. Group Shifted Strings
  8. Given an integer array arr, count element x such that x + 1 is also in arr.
  9. Middle of the Linked List
  10. Backspace String Compare
  11. Logger Rate Limiter
  12. Top k most repeated elements (nlogn using Heap)
  13. Min stack (constant time)
  14. Diameter of a Binary Tree
  15. Largest Stone (heap log(n))
  16. Contigous binary array
  17. Perform String Shifts (o(n))
  18. Array Except Self
  19. Valid Paranthesis with * O(n)
  20. Number of Islands (DFS/BFS)
  21. Minimum Path Sum
  22. Search in Rotated Array (O(logn))
  23. Construct Binary Search Tree from Preorder Traversal
  24. Leftmost Column with at Least a One
  25. Sum of subarray with k
  26. Bitwise AND of all numbers using Brian Kernighan's Algorithm O(n)
  27. LRU Cache
  28. Jump Game
  29. Longest common subsequence
  30. Maximal Square
  31. First Unique Number
  32. Binary Tree Maximum Path Sum
  33. Root to Leaves Path in a Binary Tree
  34. First Bad version
  35. Jewels and Stone (set based solution)
  36. Bit Manipulation Compliment of a number
  37. Ransom Note (Hash solution)
  38. First Unique Character in a String
  39. Majority Element n/2
  40. Cousins of Binary Tree
  41. Check is set of line is straightline
  42. Valid Perfect Square using Binary Search
  43. Find the town judge O(n)
  44. Flood Fill
  45. Single Element Sorted Array
  46. Remove K digits such that number is smaller
  47. Trie Tree (Prefix Tree)
  48. Maximum sum circular sub array
  49. Odd-Even Linked list
  50. Permutation in String
  51. Online Stock Span
  52. Kth Smallest Element
  53. Count Square Submatrices with All Ones
  54. Sort Characters By Frequency
  55. Interval List Intersection
  56. Construct Binary Search Tree from Preorder Traversal
  57. Uncrossed Lines
  58. Contigous array through Hashmap
  59. Possible Bipartition
  60. Counting Bits
  61. Find All Anagrams in a String
  62. Course Schedule - Topological Sorting
  63. K closest point to origin
  64. Edit distance dynamic programming