My own solutions to the problems in the Algorithms Toolbox course.
Week 2
- Find the nth Fibonacci Number Fn
- Find the last digit of a large Fibonacci number
- Euclidian algorithm for GCD
- LCM of two positive integers
- Compute Fn modulo m where n may be very large
- Find the last digit of the sum of the first n Fibonacci numbers
- Find the last digit of the sum of Fibonacci numbers m through n
- Find the last digit of the sum of the squares of the first n Fibonacci numbers
Week 3
- Greedy algorithm for changing money
- Fractional knapsack via greedy algorithm
- Complete trip with fewest stops to refuel
- Maximize advertising revenue
- Fewest points to sample all line segments
- For distinct integers ai, maximize k in a1+a2+...+ak = n
- Arrange multidigit numbers to maximize total number
Week 4
- Binary search a sorted list
- Binary search a sorted list, duplicates allowed
- Check list for presense of majority element
- 3-way partition quick sort
- Count number of inversions in a sequence
- Given points and segments, compute for each point number of segments it intersects
- Given points on 2D plane, find the closest pair Z. Implement your own recursive python deep copy
Week 5
- Money changer vis dynamic programming
- Minimum number of x2,x3,+1 operations to get n from 1
- Edit distance between two strings
- Longest common subsequence between two strings
- Longest common subsequence between three strings
Week 6