tvl-depot/scratch/deepmind/part_two/todo.org
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

2.2 KiB

Array and string manipulation

DONE Merging Meeting Times

DONE Reverse String in Place

DONE Reverse Words

DONE Merge Sorted Arrays

DONE Cafe Order Checker

Hashing and hash tables

DONE Inflight Entertainment

DONE Permutation Palindrome

DONE Word Cloud Data

DONE Top Scores

Greedy Algorithms

DONE Apple Stocks

DONE Highest Product of 3

DONE Product of All Other Numbers

TODO Cafe Order Checker

TODO In-Place Shuffle

Sorting, searching, and logarithms

TODO Find Rotation Point

TODO Find Repeat, Space Edition

TODO Top Scores

TODO Merging Meeting Times

Trees and graphs

TODO Balanced Binary Tree

TODO Binary Search Tree Checker

TODO 2nd Largest Item in a Binary Search Tree

TODO Graph Coloring

TODO MeshMessage

TODO Find Repeat, Space Edition BEAST MODE

Dynamic programming and recursion

TODO Recursive String Permutations

TODO Compute nth Fibonacci Number

TODO Making Change

TODO The Cake Thief

TODO Balanced Binary Tree

TODO Binary Search Tree Checker

TODO 2nd Largest Item in a Binary Search Tree

Queues and stacks

TODO Largest Stack

TODO Implement A Queue With Two Stacks

TODO Parenthesis Matching

TODO Bracket Validator

Linked lists

DONE Delete Node

TODO Does This Linked List Have A Cycle?

TODO Reverse A Linked List

TODO Kth to Last Node in a Singly-Linked List

TODO Find Repeat, Space Edition BEAST MODE

System design

TODO URL Shortener

TODO MillionGazillion

TODO Find Duplicate Files

General programming

TODO Rectangular Love

TODO Temperature Tracker

Bit manipulation

TODO Binary Numbers

TODO The Stolen Breakfast Drone

Combinatorics, probability, and other math

TODO Which Appears Twice

TODO Find in Ordered Set

TODO In-Place Shuffle

TODO Simulate 5-sided die

TODO Simulate 7-sided die

TODO Two Egg Problem

JavaScript

TODO JavaScript Scope

TODO What's Wrong with This JavaScript?

Coding interview tips

TODO How The Coding Interview Works

TODO General Coding Interview Advice

TODO Impostor Syndrome

TODO Why You Hit Dead Ends

TODO Tips for Getting Unstuck

TODO The 24 Hours Before Your Interview

TODO Beating Behavioral Questions

TODO Managing Your Interview Timeline