- InstaByte
- Posts
- Microsoft's Rust Plan
Microsoft's Rust Plan
ALSO: Optimistic vs Pessimistic Locking

Welcome back!
This week, we will solve the most popular number puzzle on the planet. Back in the day, many people would buy a newspaper just to solve this puzzle. Are you ready?
Today we will cover:
Valid Sudoku
Optimistic vs Pessimistic Locking
Read time: under 4 minutes
CODING CHALLENGE
Valid Sudoku
Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:
Each row must contain the digits
1-9without repetition.Each column must contain the digits
1-9without repetition.Each of the nine
3 x 3sub-boxes of the grid must contain the digits1-9without repetition.
Note:
A Sudoku board (partially filled) could be valid but is not necessarily solvable.
Only the filled cells need to be validated according to the mentioned rules.
Example 1:

Input: board =
[["5","3",".",".","7",".",".",".","."]
,["6",".",".","1","9","5",".",".","."]
,[".","9","8",".",".",".",".","6","."]
,["8",".",".",".","6",".",".",".","3"]
,["4",".",".","8",".","3",".",".","1"]
,["7",".",".",".","2",".",".",".","6"]
,[".","6",".",".",".",".","2","8","."]
,[".",".",".","4","1","9",".",".","5"]
,[".",".",".",".","8",".",".","7","9"]]
Output: trueExample 2:
Input: board =
[["8","3",".",".","7",".",".",".","."]
,["6",".",".","1","9","5",".",".","."]
,[".","9","8",".",".",".",".","6","."]
,["8",".",".",".","6",".",".",".","3"]
,["4",".",".","8",".","3",".",".","1"]
,["7",".",".",".","2",".",".",".","6"]
,[".","6",".",".",".",".","2","8","."]
,[".",".",".","4","1","9",".",".","5"]
,[".",".",".",".","8",".",".","7","9"]]
Output: false
Explanation: Same as Example 1, except with the 5 in the top left corner being modified to 8. Since there are two 8's in the top left 3x3 sub-box, it is invalid.Solve the problem here before reading the solution.
PRESENTED BY THE CODE
Find out why 100K+ engineers read The Code twice a week
Staying behind on tech trends can be a career killer.
But let’s face it, no one has hours to spare every week trying to stay updated.
That’s why over 100,000 engineers at companies like Google, Meta, and Apple read The Code twice a week.
Here’s why it works:
No fluff, just signal – Learn the most important tech news delivered in just two short emails.
Supercharge your skills – Get access to top research papers and resources that give you an edge in the industry.
See the future first – Discover what’s next before it hits the mainstream, so you can lead, not follow.
SOLUTION
To solve this problem, we'll validate the Sudoku board by checking three conditions:
No repetition in rows
No repetition in columns
No repetition in
3x3sub-boxes
We'll use sets to efficiently track unique digits in each row, column, and sub-box. By checking each condition during a pass through the board, we can determine its validity.
Time complexity is O(1) since the board size is fixed at 9x9. Space complexity is also O(1) as we're using a constant amount of extra space.

SYSTEM DESIGN
Optimistic vs Pessimistic Locking

When multiple users try to update the same data in a database simultaneously, it can lead to data inconsistency. For example, if two bank tellers try to update a customer's balance at the same time, one update might override the other. Database locking helps prevent such conflicts.
There are two main approaches to handle concurrent updates: Optimistic Locking and Pessimistic Locking.
Optimistic Locking assumes conflicts are rare. It lets users make changes freely but checks for conflicts before saving. Each record has a version number that increases with each update. When saving changes, the system verifies if the last version number matches what it was when the user started editing. If someone else made changes in between, the version numbers won't match, and the save fails.
This approach works well for systems where conflicts are uncommon, like social media posts where users typically edit their own content. It's also more efficient since it doesn't block other users from reading or editing.
Pessimistic Locking takes a more cautious approach. When a user starts editing a record, it gets locked immediately. Other users must wait until the first user finishes.
This approach is better for systems where conflicts are likely and data consistency is crucial, like banking transactions. But it can create performance issues if locks are held for too long, as other users are forced to wait.
Here's how they compare:
Features | Optimistic Locking | Pessimistic Locking |
|---|---|---|
Performance | Better | Worse |
Concurrency | Higher | Lower |
Conflict Handling | Detects at save time | Prevents conflicts |
Best For | Low-conflict scenarios | High-conflict scenarios |
Example Use Case | Social media posts | Financial transactions |
FEATURED COURSES
5 Courses of the Week
✅ Google AI Essentials: Learn how AI tools boost productivity and spark creativity. Write effective prompts for generating content and ideas. Use AI responsibly while identifying potential biases. Develop strategies to stay current with emerging AI technologies. Apply AI to speed up daily work tasks.
✅ Python for Everybody: Learn fundamental programming concepts with Python. Master data structures and networked application interfaces. Work with databases and web scraping. Use Python for data retrieval and processing. Build applications for data visualization in a capstone project.
✅ Learning How to Learn: Master powerful mental tools for tackling tough subjects. Understand how the brain processes and chunks information. Overcome procrastination and learning illusions. Apply research-backed practices to improve study effectiveness and problem-solving skills.
✅ Prompt Engineering for ChatGPT: Apply prompt engineering techniques to work effectively with large language models. Use prompt patterns to unlock powerful AI capabilities. Create complex prompt-based applications for business and education.
✅ DeepLearning.AI Data Engineering Certificate: Build data pipelines on AWS, design data architectures, and learn batch/streaming processing. Hands-on labs with real-world tools.
USE AI TO EARN EXTRA $$$
Turn AI Into Your Income Stream
The AI economy is booming, and smart entrepreneurs are already profiting. Subscribe to Mindstream and get instant access to 200+ proven strategies to monetize AI tools like ChatGPT, Midjourney, and more. From content creation to automation services, discover actionable ways to build your AI-powered income. No coding required, just practical strategies that work.
NEWS
This Week in the Tech World

Microsoft's Rust Plan: Microsoft plans to eliminate all C/C++ code by 2030, replacing it with Rust using AI-assisted refactoring. The company's goal is "1 engineer, 1 month, 1 million lines of code."
Nvidia Acquires Groq Tech: Nvidia licenses Groq's inference technology for a reported $20 billion and hires founder Jonathan Ross. Groq's LPU chip claims 10x faster inference using one-tenth the energy.
Google Buys Intersect Power: Alphabet acquires data center and energy infrastructure firm Intersect for $4.75 billion plus debt. The deal secures gigawatts of power capacity for Google's AI data centers.
GitHub Copilot Goes Free: GitHub launched a free Copilot tier offering 2,000 code completions and 50 chat messages monthly. Users can access Claude 3.5 Sonnet and choose from multiple AI models.
TikTok Sale Finalized: TikTok signed agreements to sell its U.S. operations to Oracle, Silver Lake, and MGX. ByteDance retains under 20% ownership with the deal closing January 22.
Snowflake Backs AtScale: AtScale announced new equity financing led by Snowflake to deepen integration for enterprise AI and data analytics stacks across cloud platforms.
Nscale Raises $865M: UK-based Nscale secured $865 million in funding to expand its specialized GPU-as-a-Service infrastructure in the U.S. for AI workloads.
Data Center Water Usage: New reports reveal major tech companies' AI data centers are consuming massive water volumes in drought-prone regions, raising sustainability concerns.
BECOME SUPERHUMAN WITH AI
Go from AI overwhelmed to AI savvy professional
AI will eliminate 300 million jobs in the next 5 years.
Yours doesn't have to be one of them.
Here's how to future-proof your career:
Join the Superhuman AI newsletter - read by 1M+ professionals
Learn AI skills in 3 mins a day
Become the AI expert on your team
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,



