Skip to content

Rpaudel379/Coding-Problems

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  1. Spiral print of a matrix
  2. Given a tree (which has left, right, and previous pointers), you need to populate each previous pointer to point to its previous left node. If there is no previous left node, the previous pointer should be set to NULL.
  3. Print all the possible permutations of a string. Then he asked me to modify my code so that there were no duplicates
  4. To print all the subsequences of a string.
  5. There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i]. It costs cost[i] of gas to travel from the station to its next (i + 1) station. Given two integer arrays of gas and cost, return the starting gas station’s index if you can travel around the circuit once in the clockwise direction with enough gas, otherwise, return -1. He wanted an O(n) approach.
  6. Implement a function which, given an array of integers, returns a new array for which every index carries the value of the product of the remaining elements - should be O(n)
  7. Replace every array element by multiplication of previous and next

Two pointer

  1. Remove Duplicates from Sorted Array, leetcode 26

  2. Missing number, leetcode 268

  3. Reverse characters using two pointers

  4. Rotate Array, leetcode 189

  5. Container With Most Water, leetcode 11

  6. Consider a string S, that is a series of characters, each followed by its frequency as an integer. The string is not compressed correctly, so there may be multiple occurrences of the same character. A properly compressed string will consist of one instance of each character in alphabetical order followed by the total count of that character within the string. The string 'a3c9b2c1' has two instances where 'c is followed by a count: once with 9 occurrences, and again with 1. It should be compressed to 'a3b2c10'.

  7. Valid Sudoku, leetcode 36

  8. Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list of strings, encode and decode, leetcode 271

  9. Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n) time. leetcode 128

  10. 3sum, leetcode 15

  11. Trapping Rain Water, leetcode 42

  12. Valid Parentheses, leetcode 20

  13. Min Stack, leetcode 155

  14. Two sum, leetcode 1

  15. Two Sum II - Input Array Is Sorted, leetcode 167

  16. Contains Duplicate, leetcode 217

  17. Top K Frequent Elements, leetcode 347

  18. The kth Factor of n, leetcode 1492

  19. Valid Palindrome, leetcode 125

  20. First Unique Character in a String, 387

  21. Best Time to Buy and Sell Stock, leetcode 121

  22. Product of Array Except Self, leetcode 238

  23. Best Time to Buy and Sell Stock 2, leetcode 122

  24. Evaluate Reverse Polish Notation, leetcode 150

  25. Generate Parentheses, leetcode 22

  26. Daily Temperatures, leetcode 739

  27. Next Greater Element I, leetcode 496

  28. Car Fleet, leetcode 853

  29. Largest Rectangle in Histogram, leetcode 84

Binary Search

  1. Binary Search, leetcode 704

  2. Search a 2D Matrix, leetcode 74

  3. Koko Eating Bananas, leetcode 875

  4. Find Minimum in Rotated Sorted Array, leetcode 153

  5. Search in Rotated Sorted Array, leetcode 33

  6. Time Based Key-Value Store, leetcode 981

  7. Median of Two Sorted Arrays, leetcode 4

  8. Kadane's Algorithm, not a binary search topic

Sliding Window

  1. Longest Substring Without Repeating Characters, leetcode 3
  2. Longest Repeating Character Replacement, leetcode 424
  3. Permutation in String, leetcode 567
  4. Minimum Window Substring, leetcode 76
  5. Sliding Window Maximum, leetcode 239

Linked List

  1. Reverse Linked List, leetcode 206
  2. Merge Two Sorted Lists, leetcode 21
  3. Reorder List, leetcode 143
  4. Remove Nth Node From End of List, leetcode 19
  5. Copy List with Random Pointer, leetcode 138
  6. Add Two Numbers, leetcode 2
  7. Detect a cycle Linked List, leetcode 141
  8. Find the Duplicate Number, leetcode 287
  9. LRU Cache, leetcode 146
  10. Merge k Sorted Lists, leetcode 23
  11. Reverse Nodes in k-Group, leetcode 25

Tree

  1. Invert Binary Tree, leetcode 226
  2. Maximum Depth of Binary Tree, leetcode 104
  3. Diameter of Binary Tree, leetcode 543
  4. Balanced Binary Tree, leetcode 110
  5. Same Tree, leetcode 100
  6. Subtree of Another Tree, leetcode 572
  7. Lowest Common Ancestor of a Binary Search Tree, leetcode 325
  8. Binary Tree Level Order Traversal, leetcode 102
  9. Binary Tree Right Side View, leetcode 199

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published