Hello future FAANG Developers,
Today’s question was asked to a friend of mine for his Netflix interview. I’m sharing this because there are a ton of ways to actually solve this, but the optimal solution is actually O(1) time and O(1) space. If you can do this, you are guaranteed to have the most optimal solution, and impress your interviewer.
Problem
This problem was asked by Netflix.
You have n
coins and you want to build a staircase with these coins. The staircase consists of k
rows where the ith
row has exactly i
coins. The last row of the staircase may be incomplete.
Given the integer n
, return the number of complete rows of the staircase you will build.
For example, given n=5 you will return 2.
Make sure you like this question on Substack. It really helps the newsletter grow. The solution to this problem will be shared tomorrow with the premium subscribers of the newsletter.
This problem can also be found as Leetcode 441. You can use it to verify your code.
For a free trial of the newsletter, subscribe here. This will give you month-long access to the newsletter. This offer runs out May 13,2022; so act quickly!!!
Consider filling out this survey. This helps me understand you better and will allow me to improve the content: Link: https://forms.gle/XfTXSjnC8W2wR9qT9
Struggling to Prepare for Coding Interviews? Stuck on Leetcode Questions? Too busy to go through the endless resources available online? Subscribe to Coding Interviews Made Simple, a newsletter to help you succeed with your newsletter. Using techniques developed through my proven track record of mentoring people with their interviews, I will help you ace your FAANG/MAANG (and other Software Engineering) interviews.
Happy Prep. I’ll see you at your dream job.
The funniest coding newsletter writer,
Devansh <3
Reach out to me on:
Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/
My content:
Read my articles: https://rb.gy/zn1aiu
My YouTube: https://rb.gy/88iwdd
Get a free stock on Robinhood. No risk to you, so not using the link is losing free money: https://join.robinhood.com/fnud75