- InstaByte
- Posts
- Uber's favorite problem
Uber's favorite problem
ALSO: CI/CD Pipeline
Welcome back!
This weekโs problem might get your heart rate up. Hereโs what the expect today:
Climbing Stairs problem
CI/CD pipelines
Read time: under 4 minutes
CODING CHALLENGE
Climbing Stairs
You are climbing a staircase. It takes n
steps to reach the top.
Each time you can either climb 1
or 2
steps. In how many distinct ways can you climb to the top?
Example 1:
Input: n = 2
Output: 2
Explanation: There are two ways to climb to the top.
1. 1 step + 1 step
2. 2 steps
Example 2:
Input: n = 3
Output: 3
Explanation: There are three ways to climb to the top.
1. 1 step + 1 step + 1 step
2. 1 step + 2 steps
3. 2 steps + 1 step
Solve the problem here before reading the solution.
SOLUTION
To solve this problem, we can use dynamic programming. We'll build our solution from the bottom up.
For any step n
, the number of ways to reach it is the sum of ways to reach (n-1)
and (n-2)
. This is because we can reach step n
by either taking one step from (n-1)
or (n-2)
.
Note that the case where we take 2
steps from (n-2)
to (n)
is also included in this because we will have to take one step from (n-1)
in this case.
The time complexity of this solution is O(n)
, where n
is the number of steps.
COMMUNITY
InstaByte Question Bank
๐ง Help each other by sharing the actual questions you were asked in a recent interview. Use this form to submit your question.
We will share the submitted questions on this weekly newsletter - stay tuned!
Note: Your submission is anonymous.
CI/CD
CI/CD pipelines
After the recent โBlue Screen of Deathโ outage at Microsoft, CI/CD has become a hot topic again. Letโs try to understand what CI/CD means.
CI/CD is a set of practices that aims to improve the speed and reliability of software releases.
There are two parts in CI/CD:
Continuous Integration (CI): CI is about merging code changes frequently. Developers push their code to a shared repository multiple times a day. Each integration is verified by automated builds and tests. This helps catch and fix issues early.
Continuous Delivery (CD): CD takes the code that passed CI and automatically deploys it to a staging environment. It ensures that the code is always in a deployable state. The final step to production can be manual or automated.
Now, let's see what a CI/CD pipeline might look like:
Code commit: Developers push code to the repository.
Build: The application is compiled.
Unit tests: Small parts of the code are tested individually.
Integration tests: Different parts of the application are tested together.
Deploy to staging: The application is automatically deployed to a test environment.
Acceptance tests: The application is tested in an environment similar to production.
Manual approval: A team member reviews and approves the changes.
Deploy to production: The application is deployed to the live environment.
Post-deployment tests: Final checks are done to ensure everything works in production.
Monitoring: Appropriate alarms are set to find issues in the production servers.
Steps 1 to 5 are CI and steps 6-10 are CD.
NEWS
This Week in the Tech World
OpenAI Co-founder Raises $1B: Ilya Sutskever's new AI firm, Safe Superintelligence (SSI), secured $1 billion in funding from major investors. The company aims to develop safe superintelligent AI with a singular focus.
Uber Invests in Wayve: Uber takes a stake in self-driving tech startup Wayve, extending the company's $1 billion funding round. The partnership aims to integrate Wayve's AV2.0 technology into consumer vehicles.
Anthropic Launches Claude Enterprise: AI startup Anthropic released Claude Enterprise, a large-scale AI solution for businesses. The product offers enhanced features like larger context windows and activity feeds for users.
Amazon Checkout Glitch: Amazon's checkout function experienced technical issues during its Labor Day sale, preventing customers from completing purchases. The company's cloud division, AWS, reported no problems.
Alibaba Adds WeChat Pay: Alibaba's Taobao and Tmall e-commerce platforms will now accept payments through Tencent's WeChat Pay. This move could increase Alibaba's market share in less developed parts of China.
Bluesky Gains Users After X Ban: Social media platform Bluesky attracted 2 million new users in a week following Brazil's ban on Elon Musk's X platform. Bluesky is now the top free app on Brazil's iOS App Store.
Hotels Adopt Digital Keys: Major hotel chains are replacing plastic room keys with digital options using Apple Wallet and Google Wallet apps. The shift aims to improve security and convenience for guests.
HELP US
๐ Hi there! We are on a mission to provide as much value as possible for free. If you want this newsletter to remain free, please help us grow by referring your friends:
๐ Share your referral link on LinkedIn or directly with your friends.
๐ Check your referrals status here.
BONUS
Just for laughs ๐
YOUR FEEDBACK
What did you think of this week's email?Your feedback helps us create better emails for you! |
Until next time, take care! ๐
Cheers,