- InstaByte
- Posts
- Meta planning 20% layoffs
Meta planning 20% layoffs
ALSO: OAuth vs JWT for Authentication
Welcome back!
Most people have already solved the 'Two Sum problem'. This week, we will solve a slightly harder variation of the 'Two Sum problem'. Let's see if you can solve it by yourself.
Today we will cover:
Two Sum II - Input Array Is Sorted
OAuth vs JWT for Authentication
Read time: under 4 minutes
CODING CHALLENGE
Two Sum II - Input Array Is Sorted
Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numbers be numbers[index1] and numbers[index2] where 1 <= index1 < index2 <= numbers.length.
Return the indices of the two numbers, index1 and index2, added by one as an integer array [index1, index2] of length 2.
The tests are generated such that there is exactly one solution. You may not use the same element twice.
Your solution must use only constant extra space.
Example 1:
Input: numbers = [2,7,11,15], target = 9
Output: [1,2]
Explanation: The sum of 2 and 7 is 9. Therefore, index1 = 1, index2 = 2. We return [1, 2].Example 2:
Input: numbers = [2,3,4], target = 6
Output: [1,3]
Explanation: The sum of 2 and 4 is 6. Therefore index1 = 1, index2 = 3. We return [1, 3].Example 3:
Input: numbers = [-1,0], target = -1
Output: [1,2]
Explanation: The sum of -1 and 0 is -1. Therefore index1 = 1, index2 = 2. We return [1, 2].Solve the problem here before reading the solution.
PRESENTED BY MINDSTREAM
Turn AI Into Extra Income
You don’t need to be a coder to make AI work for you. Subscribe to Mindstream and get 200+ proven ideas showing how real people are using ChatGPT, Midjourney, and other tools to earn on the side.
From small wins to full-on ventures, this guide helps you turn AI skills into real results, without the overwhelm.
SOLUTION
We can solve this problem efficiently using the two-pointer approach. Since the input array is already sorted in non-decreasing order, we can place one pointer at the beginning and another at the end of the array.
We'll move the pointers based on the sum of the elements at those indices compared to the target. If the sum is less than the target, we'll move the left pointer to the right to increase the sum. If the sum is greater than the target, we'll move the right pointer to the left to decrease the sum.
This approach allows us to find the two numbers that add up to the target while using only constant extra space.
The time complexity of this solution is O(n), where n is the length of the input array. We make a single pass through the array, and the two pointers converge towards each other.

HEARD OF PROTON?
Free email without sacrificing your privacy
Gmail tracks you. Proton doesn’t. Get private email that puts your data — and your privacy — first.
SYSTEM DESIGN
OAuth vs JWT for Authentication

When building applications that require user authentication, developers often get confused between OAuth and JWT (JSON Web Tokens). While both are related to authentication and authorization, they serve different purposes and can even be used together.
OAuth is a protocol that enables applications to obtain limited access to user accounts on other services. When you click ""Login with Google,"" you're using OAuth. The application gets a token to access specific parts of your Google account, but not your actual Google password.
JWT, on the other hand, is a format for securely transmitting information between parties as a JSON object. This token contains user information and is digitally signed to ensure it hasn't been tampered with. When a user logs in, the server creates a JWT containing user details and permissions, which the client then uses for subsequent requests.
OAuth involves multiple parties: the user, the application (client), and the authentication server (like Google). The application redirects users to the authentication server, where they log in directly. This makes OAuth more secure for third-party authentication since the application never sees the user's credentials.
JWTs are simpler - they typically involve just the application and its users. The application handles login directly and issues JWTs. While this is fine for simple applications, it means you're responsible for securely storing and managing user credentials.
Here's what makes each option better for different scenarios:
Use OAuth when you want users to log in using their existing accounts from other services (like Google or Facebook)
Use JWTs when you're building a self-contained application and want to manage authentication yourself
Here's a comparison of OAuth and JWT:
Feature | OAuth | JWT |
|---|---|---|
Purpose | Authorization protocol | Token format |
Complexity | More complex | Simpler |
Best For | Third-party authentication | Direct authentication |
Security responsibility | Shared with auth provider | Handled by application |
FEATURED COURSES
5 Courses of the Week
✅ Microsoft’s Full-Stack Developer Certificate: Learn front-end and back-end development using .NET, C#, Blazor, and Microsoft Copilot. Build complete web apps with focus on security and deployment.
✅ Amazon’s DSA: Implement and analyze fundamental data structures and algorithms in Java, including sorting, searching, and recursive techniques with JUnit testing methodology.
✅ Google’s Intro to Git & GitHub: Understand version control and learn how to collaborate with others using Git and Github.
✅ IBM’s Python for Data Science, AI & Development: Learn Python basics, data structures, and libraries (Pandas, NumPy) for data science and automation in this beginner-friendly course. You'll gain hands-on experience with Jupyter Notebooks, performing tasks like data collection and web scraping with APIs.
✅ Automate the Boring Stuff with Python: Practical Python automation course for complete beginners covering web scraping, PDF/Excel parsing and other productivity tasks to streamline tedious work without requiring computer science background.
NEWS
This Week in the Tech World

Meta Planning 20% Layoffs: Meta is reportedly cutting up to 16,000 jobs to offset massive AI infrastructure spending. Stock climbed ~3% on the news.
Nvidia Unveils Vera Rubin at GTC: Next-gen AI platform delivers 10x inference per watt over Blackwell. Huang projects $1T in AI chip revenue by 2027.
Microsoft May Sue Over Amazon-OpenAI Deal: Microsoft weighs legal action over a $50B deal that makes AWS the cloud provider for OpenAI's Frontier AI agent platform.
Atlassian Cuts 1,600 Jobs: Atlassian laid off 10% of its workforce to fund its AI pivot and enterprise sales push. CTO Rajeev Rajan is also stepping down.
Linux Foundation Gets $12.5M for OSS Security: Google, Microsoft, OpenAI, and Anthropic fund effort to help FOSS maintainers overwhelmed by AI-generated bug reports.
Nvidia Announces DLSS 5: New neural rendering tech adds AI-powered photoreal lighting to games. Launching this fall, it's already drawing backlash from developers and artists.
Nvidia Restarts H200 Chip Production for China: After a 10-month freeze, Nvidia resumes H200 manufacturing for Chinese customers following US and China regulatory approvals.
OpenAI ChatGPT Gets Write Actions: ChatGPT can now draft emails, create docs and spreadsheets, and schedule meetings through Google and Microsoft integrations.
NemoClaw Launches for Enterprise AI Agents: Nvidia and OpenClaw partner on an open-source enterprise agentic AI framework with built-in security sandboxing and guardrails.
BONUS
Just for laughs 😏

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.
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,



