☕ Bitcoin reaches a new high!
Bitcoin reaches a new all time high (more than the previous high in 2017). Why you should be paying attention to this as a developer.
Hi Everyone!
Tech Dive
No tech dive for today unfortunately! Here’s the schedule for future tech dives
Coming soon - Database Sharding in Practice
Our last tech dive was on APIs!
Interview Question
Given two strings s
and t
, determine if they are isomorphic.
Two strings are isomorphic if the characters in s
and be replaced to get t
.
All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character may map to itself.
Here’s the question in LeetCode.
We’ll send a detailed solution 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
Bitcoin Reaches a new All Time High!
Bitcoin has been on a tear this year and is the best performing asset class of 2020, up more than 170%.
The previous all-time high for Bitcoin was $19,783 in December of 2017. Today, Bitcoin has now surpassed that price.
Programmable Money
You might be wondering, as a developer, why should you care?
The key here is that Bitcoin is programmable money. This opens up use-cases that never existed and shifts power from bankers to software developers.
Banking used to be governed by law but it’s shifting to being governed by code.
This isn’t just with Bitcoin, there’s been a big trend towards Central Bank Digital Currencies with many countries testing a shift away from paper money towards completely digital money.
China is currently leading the pack with their Digital Yuan. But a half dozen other countries are testing out the same concept. Digitizing fiat currency means that those currencies also become programmable.
Programmable money creates a whole host of new applications that can be built. The feeling now seems quite similar to the internet in 1995.
Applications like microtransactions, digital identity, international transactions/remittances are just a few examples of what can be built.
Currently, the internet relies on advertising as a major source of income for publishers and creators. This model obviously has drawbacks in terms of privacy, censorship and incentives.
With programmable money, we could create an alternate system where every time you want to view an article, you send a payment of $0.004 to the publisher!
If you have any questions, feel free to reply to this email! I love talking about this stuff.
Here’s an interesting article on Cryptocurrency predictions in 2020.
Previous Solution
As a refresher, here’s the previous question
Write a function to calculate pow(x, n)
, which is x
raised to the power n
.
Here’s a link to the question in LeetCode
Solution
This question requires (a bit) of math knowledge.
You should have a solid understanding on how exponents work.
To solve this, we use the property that
Using this property, we’ll we can reason that if n is even, then we calculate pow(x,n/2)
and then return the square of that ( finding the square is a O(1)
time operation).
If n is odd, then we can calculate pow(x, n - 1)
and then return that times x
. Remember that n - 1
will always be even if n
is odd.
We keep repeating this until our base case, where n == 0 or n == 1.
This makes our time complexity logarithmic, since every time n
is even, we’re dividing the number of operations by 2 and every time n
is odd, we’re doing a constant time operation.
Modifying our function to work for negative exponents is trivial, we just change the odd case to truncate instead of subtracting by 1.
Here’s a link to the REPL with Python 3 code.
If you have any feedback or questions, feel free to reply to this email!
Best,
Arpan