Skip to content

TedTran2019-Interview-Prep/Leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 

Repository files navigation

Leetcode

2022

I didn't record any information about the problems I've done. It would be ideal to classify problems and note how they were solved.

2023

Hash Table

  • Two Sum: Check Hashmap for complement

Array

  • Remove Duplicates: Swap placeholder for greater value
    • Plan before execution
  • Remove Element: Swap placeholder for non-target
    • More or less, both remove problems just involve keeping track of two indices
  • Plus One: Iterate backwards, unshift, and either logic or mod/divide.
  • Merge: Using an array to hold values in sorted order until they're ready to be inserted
    • A better solution is to iterate backwards, placing the largest values in nums1.
  • Pascal's Triangle: Just code the generation logic.
  • Pascal's Triangle II: N/A
  • Best Time to Buy and Sell Stock: Compare current lowest price with future prices until new lowest price is found, keeping track of highest profit.

String

  • Roman to Integer: Utilize a hashmap, and add or subtract value depending on next symbol

Linked List

  • Add Two Numbers: Div, mod, and carries
    • The cleanup for this one is really nice since no value can be changed to 0
  • Merge Two Sorted Lists: Linked List understanding/knowledge.

Binary Search

  • Search Insert: Just binary search, but return low if not found

Binary Search Tree

  • Sorted Array to BST: Recursive solution that ensures every tree is a BST

Bitwise Operations

  • Single Number: Xor

Dynamic Programming

  • Climbing Stairs: Think of a decision tree + cache or think about fibo (how the previous two results create the next)

Releases

No releases published

Packages

No packages published

Languages