Jadi on Nostr: having an array of a stock's price in every single day, how can we maximize our ...
having an array of a stock's price in every single day, how can we maximize our profit with just one buy and one sell? This is a famous interview question in many companies.
Here I'll show you a BAD solution first so we can understand why its bad and have a practical intro to BIG O notation. Then we will cover a good solution to understand the difference between O(n^2) and O(n).
https://youtu.be/qtuOSS1pA3c#programming #algorithm #interview
Published at
2024-08-27 14:09:28Event JSON
{
"id": "c2fb97988f395bac223d1f8a92c5ef4ce5e2f1cf56ec7be6d0a88742ec375d72",
"pubkey": "c28aece562af2d5d33e79775d29fe6026023e55e641bfc03e138b2066ed9113a",
"created_at": 1724767768,
"kind": 1,
"tags": [
[
"t",
"programming"
],
[
"t",
"algorithm"
],
[
"t",
"interview"
]
],
"content": "having an array of a stock's price in every single day, how can we maximize our profit with just one buy and one sell? This is a famous interview question in many companies. \n\nHere I'll show you a BAD solution first so we can understand why its bad and have a practical intro to BIG O notation. Then we will cover a good solution to understand the difference between O(n^2) and O(n).\n\nhttps://youtu.be/qtuOSS1pA3c\n\n#programming #algorithm #interview ",
"sig": "350722f7bef1f269726966559ff0c270fdf45c28794f4aeadd1ecf2ff956467924bd97802abd6c6e4ec80fa1646283f9c3f00a49849f41beca1486f110b58a3a"
}