One of my favorite interview questions is simple on the surface: - Why do we use context managers in Python? Almost instantly, the answer comes: So we don’t have to close connections manually. It auto-closes them. Fair. But then I take it one step further: Why do we need to close connections at all? Why not just leave them open? That’s where things get interesting. Some candidates pause. Some say: It’s not a good practice to leave things open. And I push again: But why is it not a good practice? Because there has to be a reason… right? Only a handful go deeper and talk about: - Limited system resources - File descriptors - Connection/socket limits managed by the OS And that’s the moment you can clearly see the difference. 💡 Context managers (`with` statement) are not just about cleaner syntax. They ensure deterministic resource management, releasing critical resources like files, sockets, and locks as soon as they’re no longer needed. Sometimes, it’s not about what you know… but how far you can go when someone asks “why?” Follow Hitesh Garg for more 🫡 #python #interviews #backend
Hitesh Garg’s Post
More Relevant Posts
-
Stop revising Python randomly before interviews. Jumping from one concept to another. Solving random questions without direction. Watching multiple videos and still feeling unprepared. That’s not revision. That’s panic. When interviews are close, you don’t need more content. You need structured problem solving. So I created a Last Minute Python Interview Prep video. No long explanations. No unnecessary theory. No distractions. Just: • Handpicked problems • Step-by-step thinking • Clear approach to solve them • Patterns that actually get asked Because in interviews, it’s not about how much you know. It’s about how you think. If your interview is in the next few days, this will help you bring everything together. Link to the video in comments 👇
To view or add a comment, sign in
-
-
Most devs fail sliding window problems in interviews. Not because they don't know the algorithm. Because they can't explain why it works. Here's the mental model that changes everything: Brute force checks every substring from scratch → O(n³) Sliding window reuses what you already know → O(n) The key insight: when you hit a duplicate character, you don't restart. You just shrink from the left until the duplicate is gone. Two pointers. One set. Linear time. while s[right] in char_set: char_set.remove(s[left]) left += 1 That single loop is the entire trick. Each character is visited at most twice — once added, once removed. That's why it's O(n) despite the nested while. I've seen candidates code this correctly and still get rejected. Because when the interviewer asked "why is this linear?" they froze. Complexity analysis isn't a bonus point. It's the interview. Can you explain O(n) vs O(n²) to a 5-year-old? #TechInterviews #Python #Algorithms #SoftwareEngineering #CodingInterview
To view or add a comment, sign in
-
-
Overcomplicated solutions are not a flex in #Amazon interviews. Swipe to see what actually gets you the offer! ↑ Watch before your next interview → link in comments! 🔗 #Python #DataStructures #AlgorithmInterview #CodingInterview #AmazonInterview #BinaryTrees #SoftwareEngineering #TechInterview #LeetCode #StrataScratch
To view or add a comment, sign in
-
🚀 Last-minute interview prep? I found something actually useful. I was looking for quick revision content before interviews (without going into 10 different resources)… and came across this playlist by Ankit Bansal Honestly, it's precisely what most of us need at the last moment. It covers: 📊 SQL (real interview-focused) 🏗️ Data Warehousing & Modeling ⚡ Spark basics 🐍 Python concepts No unnecessary theory. No over-explaining. Just the kind of questions and concepts that actually come up in interviews. 💡 What stood out to me: → You can revise fast without feeling overwhelmed → Content is practical, not textbook-style → Good for connecting scattered concepts quickly Most of the time, we overprepare or keep jumping between resources. But before interviews, what really helps is: clarity + focused revision. This is one of those resources. If you’re in the same phase, it might help you too. Don’t aim to learn everything. Aim to revise what matters. #DataAnalytics #SQL #Python #DataEngineering #InterviewPrep #JobPreparation #CareerGrowth #Upskilling #DataAnalyst
To view or add a comment, sign in
-
-
One SQL mistake can change the entire interview. Not tools. Not experience. Just this: 👉 SQL 👉 Python 👉 How you think under pressure That’s what Data Engineering interviews really test. Mistakes in interviews are costly. Once you lose an opportunity, it may become someone else’s opportunity. Be prepared before you attend. Don’t attend interviews just to test your luck. We spend months chasing tools… But fundamentals are what actually decide the result. Are we preparing the right way? #DataEngineering #SQL #Python #InterviewPrep #TechCareers #Learning #CareerGrowth #Engineers #RealTalk
To view or add a comment, sign in
-
Coding interviews aren’t about solving random problems. They’re about recognizing patterns... .... If you focus on the right patterns, preparation becomes much easier. Here are some important ones to cover: 1. Sliding Window → Longest Substring with K Distinct Characters 2. Intervals → Merge Overlapping Intervals 3. Two Pointers → Container With Most Water 4. Subsets / Substrings → Maximum Subarray 5. Palindromes → Longest Palindromic Substring 6. Dynamic Programming (Decision Making) → Best Time to Buy and Sell Stock You don’t need to solve 100s of problems. Focus on understanding these patterns deeply, and you’ll be able to tackle a wide range of questions. Good luck with your upcoming Interview ❤️
To view or add a comment, sign in
-
-
🚫 𝗦𝘁𝗼𝗽 𝗽𝗿𝗲𝗽𝗮𝗿𝗶𝗻𝗴 𝗳𝗼𝗿 𝗣𝘆𝘁𝗵𝗼𝗻 𝗶𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄𝘀 𝗿𝗮𝗻𝗱𝗼𝗺𝗹𝘆… Or you’ll keep studying… but still struggle in interviews 👀 But the problem is not the resource 👇 👉 It’s the way you’re using it. --- 🚫 𝗪𝗿𝗼𝗻𝗴 𝘄𝗮𝘆: • Reading answers directly • Highlighting everything • Thinking “prep ho gaya” --- ✅ 𝗥𝗶𝗴𝗵𝘁 𝘄𝗮𝘆: 📌 1. 𝗔𝗻𝘀𝘄𝗲𝗿 𝗱𝗲𝗸𝗵𝗻𝗲 𝘀𝗲 𝗽𝗲𝗵𝗹𝗲 𝗸𝗵𝘂𝗱 𝘀𝗼𝗰𝗵𝗼 👉 Try explaining it yourself first --- 📌 2. 𝗦𝗶𝗺𝗽𝗹𝗲 𝗹𝗮𝗻𝗴𝘂𝗮𝗴𝗲 𝗺𝗲𝗶𝗻 𝗯𝗼𝗹𝗼 👉 No book definitions 👉 Only clear understanding --- 📌 3. 𝗖𝗼𝗱𝗲 𝗲𝘃𝗲𝗿𝘆 𝗰𝗼𝗻𝗰𝗲𝗽𝘁 💻 Generators → try karo Decorators → implement karo OOP → mini examples banao --- 📌 4. 𝗥𝗲𝗮𝗹 𝘂𝘀𝗲-𝗰𝗮𝘀𝗲 𝘀𝗼𝗰𝗵𝗼 👉 “Ye kaha use hoga?” This is what interviewers check. --- 📌 5. 𝗠𝗶𝘀𝘁𝗮𝗸𝗲 𝗹𝗶𝘀𝘁 𝗯𝗮𝗻𝗮𝗼 👉 Jo nahi aata wahi likho 👉 Last day wahi revise karo ⚡ --- 📌 6. 𝗢𝘂𝘁 𝗹𝗼𝘂𝗱 𝗽𝗿𝗮𝗰𝘁𝗶𝗰𝗲 👉 Sit and explain answers yourself 👉 That’s real interview prep --- 💡 𝗙𝗶𝗻𝗮𝗹 𝘁𝗿𝘂𝘁𝗵: PDF complete karne se selection nahi hota. 👉 𝗧𝗵𝗶𝗻𝗸 + 𝗘𝘅𝗽𝗹𝗮𝗶𝗻 + 𝗖𝗼𝗱𝗲 = Selection --- 📎 Python Interview QNA PDF attached (Use it the RIGHT way 👆) --- 💬 𝗙𝗶𝗿𝘀𝘁 𝗖𝗼𝗺𝗺𝗲𝗻𝘁: “इस बार Python interview crack hoga 🔥” --- ♻️ Save this 📤 Share with your friend ➕ Follow for real placement prep content #Python #InterviewPrep #Placements #Coding #Developers #LearnPython
To view or add a comment, sign in
-
A few months ago, one of my juniors called me late at night. He said, “I know Python. I’ve done SQL. I’ve watched so many tutorials… but I still don’t feel ready for interviews.” This is where most people get stuck. They are learning, but not in a way that prepares them for real interviews. The problem is not lack of effort. It’s lack of direction and structure. I’ve seen this pattern again and again. People keep switching resources, solving random questions, and consuming content… but don’t follow a clear roadmap. That’s where platforms like AccioJob come in. They focus on turning learning into real interview readiness, not just theory. Because at the end of the day, it’s not about “I know this” it’s about “I can crack this.” If you are curious to explore. Check out here : https://lnkd.in/gSGn2Sgr #AccioJob #AccioJobReview #AccioJobHonestReview #AccioJobScam #AccioJobPlacements #AccioJobHiringDrives
To view or add a comment, sign in
-
-
10 String Patterns for Interviews Follow Algonur Visit https://www.algonur.com for more details Save this for your next Interview #DataStructures #Algorithms #CodingInterview #Programming #SoftwareEngineering #LeetCode #ProblemSolving #TechSkills #Developers #CodingTips
To view or add a comment, sign in
-
Hey #dev, still afraid of #codechallenge? Hmmm... maybe this will help you in #job #interviews, especially if it’s in #Rust. I saw a post by Ashish Pratap Singh on LinkedIn about top #leetcode problems you should study, and, since I had already written implementations in Rust for almost all of these types of problems, I decided to create this page with explanations and source code. I had to add two or three more, but it turned out really great for you, who are studying for job interviews. Coming next: #Golang, #python, and #typescript versions. Here my repo: https://lnkd.in/df8-z4pz Follow me for more content like this one.
To view or add a comment, sign in
-
More from this author
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
I would have started with why to use python 🤣