☕ Samsung is back

Samsung has an amazing quarter. A drone startup that is building digital twins for construction projects.

Hey,

Hope you’re having an awesome day!

On to the Interview Problem and Industry News!

Interview Problem

Given a collection of numbers that may contain duplicates, return all possible unique permutations.

Input - [1, 1, 2, 3]

Output - [[1,1,2,3],[1,1,3,2],[1,2,1,3],[1,2,3,1],[1,3,1,2],[1,3,2,1],[2,1,1,3],[2,1,3,1],[2,3,1,1],[3,1,1,2],[3,1,2,1],[3,2,1,1]]

We’ll send out the solution (with working code and test cases) tomorrow, so make sure you move our emails to primary, so you don’t miss them!

Gmail users—move us to your primary inbox

  • On your phone? Hit the 3 dots at top right corner, click "Move to" then "Primary"

  • On desktop? Back out of this email then drag and drop this email into the "Primary" tab near the top left of your screen

Apple mail users—tap on our email address at the top of this email (next to "From:" on mobile) and click “Add to VIPs”

Industry News

  • Samsung has an amazing quarter - Samsung profits jumped nearly 60% last quarter, with an operating profit of $10.6 billion dollars for the quarter from July to September. The estimates beat the 26% profit bump that analysts expected. Sales rose by 6% to $57 billion dollars and that’s helping Samsung retake it’s lead as the top smartphone seller in the world (it lost that position to Huawei). One big factor that helped Samsung this year are is the US’s restrictions on Huawei, which seemed to help Samsung more than any of the other big Android makers.

  • SiteAware raises $10 million dollars to track construction zone progress using drones - In one of our last emails, we talked about the drone startup Skydio. Well, now another drone startup has raised another large round of funding.SiteAware (formerly Dronomy) has closed a $10 million dollar funding round which was co-led by Axon Ventures.The company builds drones and AI that observes construction and reports real-time insights on layout, workmanship and any omissions (like forgetting waterproofing or sealant). They provide detailed breakdowns of the elements of the building and give a great picture of how construction is going without having to be onsite.This is part of the larger trend in the “Digital Twin” space, where physical assets have a digital replica that helps leaders and owners get quick updates on how progress is going without having to be onsite. The combination of Drones and AI is immensely useful to building these “digital twin” models, and so we’re seeing tons of startups getting into this area.

Previous Solution

As a refresher, here’s the previous question

What does ACID stand for? Go through each of the letters in ACID and talk about what they each mean in the context of databases.

Solution

When you’re working with a database, you typically want to group several reads and writes together and execute them in a group. 

For example, let’s say you’re writing code for a bank and you need to write the logic for when someone transfers money from one account to another. Let’s assume there’s an associated fee for this action.

You want to

  1. Check the balance of the initial account and make sure there’s enough money for the transfer amount and fee.

  2. Deduct the transfer fee from the initial account

  3. Deduct the transfer amount from the initial account

  4. Add the transfer amount to the new account

Obviously, if any one of these database read/writes fail, then there’s an issue. It gets especially hard to debug if, say, operation #2 fails while operations #1, #3 and #4 succeed.

For this reason, transactions have been the mechanism of choice for simplifying this. 

A transaction is a way for an application to group several reads and writes into one logical unit and abstract away all the implementation details.

A transaction provides several safety guarantees, which can be stated by the acronym ACID.

  • Atomicity - Either the entire transaction succeeds, or the entire transaction fails. If there’s an error, the system will “abort” the transaction, and all past changes will be undone.

  • Consistency - A transaction will only affect the database in specific predefined ways (following the database's “invariants”). For example, if you’re working on an accounting system, then your credits and debits across all accounts must always be balanced. All transactions that succeed will leave the database in a state where that invariant is true.

  • Isolation - Most databases are accessed by multiple clients simultaneously. Sometimes, this can cause concurrency problems like race conditions. Isolation means that concurrently executing transactions are isolated from each other. The database ensures that when the transactions have committed, the result is the same as if the transactions were run one after the other.

  • Durability - Durability is the promise that once a transaction has been committed successfully, any data that it has written will not be forgotten, even if there’s a hardware fault or if the database crashes. This means that the data must be written to a non-volatile form of storage like a hard drive or an SSD. It also means that the data must be replicated in some way. In reality, perfect durability can never exist. You’ll always have some issue that can crop up somewhere and destroy your data. But, you can make the probability of losing data very, very small.