tvl-depot/scratch/deepmind/part_two
William Carroll 549e56186b Solve InterviewCake's product-of-other-numbers
This problem challenged me: without using division, write a function that maps a
list of integers into a list of the product of every integer in the list except
for the integer at that index.

This was another greedy algorithm. The take-away is to first solve the problem
using brute force; this yields an algorithm with O(n*(n-1)) time
complexity. Instead of a quadratic time complexity, a linear time complexity can
be achieved my iterating over the list of integers twice:
1. Compute the products of every number to the left of the current number.
2. Compute the products of every number to the right of the current number.

Finally, iterate over each of these and compute lhs * rhs. Even though I've
solved this problem before, I used InterviewCake's hints because I was stuck
without them.

I should revisit this problem in a few weeks.
2020-03-02 16:45:15 +00:00
..
misc Tidy up structure of briefcase 2020-02-12 16:58:29 +00:00
.envrc Tidy up structure of briefcase 2020-02-12 16:58:29 +00:00
cafe-order-checker.py Solve InterviewCake's cafe-order-checker problem 2020-02-20 15:20:58 +00:00
delete-node.py Tidy up structure of briefcase 2020-02-12 16:58:29 +00:00
highest-product-of-3.py Solve InterviewCake's highest-product-of-3 2020-03-01 22:32:25 +00:00
inflight-entertainment.ts Solve InterviewCake's inflight-entertainment problem 2020-02-21 11:30:01 +00:00
merge-sorted-arrays.ts Solve InterviewCake's merge sorted arrays question 2020-02-19 16:02:38 +00:00
merging-ranges.py Solve merging-ranges 2020-02-13 14:52:20 +00:00
package-lock.json Tidy up structure of briefcase 2020-02-12 16:58:29 +00:00
package.json Tidy up structure of briefcase 2020-02-12 16:58:29 +00:00
permutation-palindrome.py Solve InterviewCake permutation-palindrome problem 2020-03-01 22:32:24 +00:00
product-of-other-numbers.py Solve InterviewCake's product-of-other-numbers 2020-03-02 16:45:15 +00:00
reverse-string-in-place.ts Tidy up structure of briefcase 2020-02-12 16:58:29 +00:00
reverse-words.py Solve bonus part of reverse-words 2020-02-19 15:01:42 +00:00
shell.nix Remove default values for Nix expression parameters 2020-03-01 22:32:24 +00:00
stock-price.py Solve InterviewCake's stock-price problem 2020-03-01 22:32:25 +00:00
todo.org Solve InterviewCake's product-of-other-numbers 2020-03-02 16:45:15 +00:00
top-scores.py Solve InterviewCake's top-scores 2020-03-01 22:32:24 +00:00
word-cloud.py Solve InterviewCake's word-cloud problem 2020-03-01 22:32:24 +00:00