Hi everyone, Thanks for a lovely and productive session this week.
Covered -
-
Find max of array
-
Stock price: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/
-
Ways to climb stairs: http://www.geeksforgeeks.org/count-ways-reach-nth-stair/
-
Discussion: Fibonacci with memoization, only two variables http://www.geeksforgeeks.org/program-for-nth-fibonacci-number/
-
Rob houses (also see my solution below): http://www.geeksforgeeks.org/find-maximum-possible-stolen-value-houses/
def rob(nums):
if len(nums) == 0: return 0
if len(nums) <= 2: return max(nums)
max_money = [0] * len(nums)
max_money[0] = nums[0]
max_money[1] = max(nums[0], nums[1])
for house in xrange(2, len(nums)):
max_money[house] = max(max_money[house-1], max_money[house-2]+nums[house])
return max_money
- Mentioned: Knapsack problem http://www.geeksforgeeks.org/knapsack-problem/
- HackerRank/Leetcode
- Pramp https://www.pramp.com/#/
- Coderbyte https://coderbyte.com/CodingArea/Profile/
4.Upcoming technical interview workshop with the author of Cracking the Coding Interview: https://www.eventbrite.com/e/slack-devs-meetup-august-tickets-36901245619?utm_source=eb_email&utm_medium=email&utm_campaign=order_confirmation_email&utm_term=eventname&ref=eemailordconf
It's tomorrow! Aug 29