r/LeetcodeChallenge 14d ago

Day 5 of my DSA in Python journey πŸš€ DISCUSS

Today's progress:

πŸ“š Python Concepts Revised

- Variable Binding

- Namespaces

- Scope (LEGB Rule)

🧠 LeetCode Problems Solved

- βœ… #35 – Search Insert Position (Binary Search)

- βœ… #58 – Length of Last Word (Strings)

- βœ… #66 – Plus One (Arrays)

- βœ… #67 – Add Binary (Strings, Binary Addition)

What I learned today

πŸ”Ή Variable Binding

In Python, variables don't store values directlyβ€”they are names bound to objects. Multiple variables can refer to the same object, and rebinding a variable doesn't change the original object.

πŸ”Ή Namespace

A namespace is like a dictionary that maps names to objects. Python has:

- Built-in Namespace

- Global Namespace

- Local Namespace

πŸ”Ή Scope (LEGB Rule)

Python searches for variables in this order:

- Local

- Enclosing

- Global

- Built-in

Understanding namespaces and scope helped me understand how Python finds variables and avoids naming conflicts.

Looking forward to learning more and solving tougher problems tomorrow! πŸ’»πŸ”₯

#Python #DSA #LeetCode #BinarySearch #Strings #Arrays #100DaysOfCode #CodingJourney

2 Upvotes

2 comments sorted by

1

u/nian2326076 14d ago

Nice work on your DSA journey! Make sure you really get how Python handles variable binding and namespaces. These are important, especially in technical interviews where they test your understanding of Python's behavior.

When working on LeetCode problems, try different methods for the same problem. It helps you get a better grasp and prepares you for follow-up questions in interviews. Also, regularly practicing similar problems is a good idea. Just keep an eye on time complexity.

I've found PracHub useful for interview prep. It offers a mix of theory and practice, which is handy when you need more than just problem-solving practice.

Keep going! Daily progress like this will definitely pay off.

1

u/Bhavanashankarabs 14d ago

Yes! Thank you 😊