🚀 Solved Two Sum Problem with Optimal Approach | LeetCode Today I solved the classic Two Sum problem and focused on writing an efficient solution rather than just making it work. 💡 Problem: Given an array of integers, return indices of two numbers such that they add up to a target. ⚡ Approach: Instead of using the brute force method, I used a HashMap (dictionary) to store elements and their indices. 👉 Logic: Traverse the array once For each element, calculate: difference = target - current value Check if difference already exists in the HashMap If yes → return indices instantly 🔥 Time & Space Complexity: ⏱ Time Complexity: O(n) 📦 Space Complexity: O(n) 🚀 Optimization: Improved from brute force O(n²) → O(n) using HashMap lookup 🏆 Result: ✔️ Accepted (All test cases passed) ✔️ Runtime: 0 ms (Beats 100%) 📌 Key Learnings: HashMap enables constant time lookup Thinking in terms of complement simplifies problems Optimization is key in coding interviews 💻 Tech Stack: Python | Data Structures & Algorithms 📈 Consistency + Practice = Growth 🚀 #leetcode #dsa #python #algorithms #coding #programming #softwareengineering #100DaysOfCode #tech
Gopal Goswami’s Post
More Relevant Posts
-
From a simple log parser to simulating real SRE scenarios I extended my Log Analyzer project to make it more aligned with real-world production systems and incident handling. 🔧 What’s new: • Regex-based log parsing to extract timestamp, log level, and message • Top N error analysis using Python’s Counter • Error spike detection based on a time window (simulating incident conditions) 📊 Example insight: The tool can now detect abnormal error spikes within a short duration — something SREs rely on during production incidents. 💡 What I learned: Log analysis isn’t just about counting errors — it’s about identifying patterns, trends, and anomalies over time. 🔗 Project: https://lnkd.in/dEZyK7qH Next step: exploring real-time log monitoring and alerting integrations. Would love your feedback! #SRE #DevOps #Python #Observability #SiteReliabilityEngineering #LearningInPublic #GitHub
To view or add a comment, sign in
-
-
Merge In Between Linked Lists — and got it Accepted ✅ This problem really tested my understanding of: 🔹 Linked List traversal 🔹 Pointer manipulation 🔹 Edge case handling One small mistake in pointer connection... and everything breaks. 😅 But that’s where real learning happens. 💡 Key takeaway: In linked lists, it’s not about values—it's about how you connect nodes. Step by step, I’m getting stronger in data structures & algorithms and building the problem-solving mindset needed for top tech roles. 🔥 Consistency is the real game changer. #LeetCode #DSA #ProblemSolving #Python #CodingJourney #SoftwareDeveloper #FullStackDeveloper #KeepLearning
To view or add a comment, sign in
-
-
I’m excited to share a mini-automation project I recently completed: An Automated Certificate Generator. 🎓 Manually creating certificates for a large number of participants is tedious and prone to errors. To solve this, I built a Python script that handles the entire process efficiently. How it works: ✅ Data Driven: It reads participant details (Names & Departments) directly from a CSV file/Worksheet using Pandas. ✅ Dynamic Overlay: Uses the Pillow (PIL) library to precisely place text onto a high-quality certificate template. ✅ Bulk Processing: Can generate thousand of personalized certificates in a single run. Tech Stack: 🐍 Python | 🐼 Pandas | 🖼️ Pillow (PIL) Check out the code on GitHub: https://lnkd.in/dx__bkxy #Python #Automation #Programming #FullStackDeveloper #Efficiency #OpenSource #CertificateGenerator
To view or add a comment, sign in
-
If you've ever spent hours manually renaming hundreds of files or updating dizzying amounts of spreadsheet cells, you know exactly how draining it can be. That's why I decided to dive deep into the world of Python Automation to unlock the ultimate game-changer in productivity. I recently completed an intensive course that completely transformed how I approach these challenges. It taught me that writing code isn't just about solving basic problems; it's about crafting true digital artistry. 🎨 Here are some of the key skills I’ve added to my toolkit: 📂 Mastering File Handling: Automating local storage and data organization. 🕸️ Advanced Web Scraping: Extracting data efficiently using Beautiful Soup and Selenium. ⚙️ Robust Scripting: Learning the art of parsing, weaving through command lines, and implementing solid error handling. 🔗 API Integration: Seamlessly connecting different software pieces for robust, automated solutions. I’m incredibly excited to apply these time-saving skills to future projects and build systems that work smarter, not harder. What was the first tedious task you ever automated? Let me know in the comments! 👇 #Python #Automation #Coding #WebScraping #Productivity #TechSkills #ContinuousLearning #PythonDeveloper #processautomation #python.
To view or add a comment, sign in
-
🚀 Day 11 of #111DaysOfLearningForChange – Code for Change Built a GitHub Trending CLI Tool to discover popular repositories 🌐💻 📌 What I learned today: • Advanced API usage with query parameters • Building flexible CLI tools using argparse • Filtering data based on time (day, week, month, year) • Handling API responses and errors effectively 🛠️ What I built: A CLI tool that: • Fetches trending GitHub repositories 📈 • Filters results by duration (day/week/month/year) • Displays repo details (name, stars, language, link) ✨ Example usage: python trending.py --duration week --limit 5 ✨ Key takeaway: Combining APIs with CLI tools can create powerful and practical developer utilities ⚡ Challenge faced: Constructing correct API queries and handling different response cases #111DaysOfLearningForChange #CodeForChange #Python #CLI #API #GitHub #LearningInPublic https://lnkd.in/gNBy3eiN
To view or add a comment, sign in
-
-
I kept wishing I had one place that brought everything together for me to stay structured. So I built one. VIGIL is a personal system that brings tasks, habits, goals, and routines into one place. The focus is simple: track execution, stay consistent, and understand patterns over time. It includes: • tasks and checklists • habits and streak tracking • goals and routines • lightweight analytics for trends and insights Built to be simple, easy to use, and something I’d actually stick with daily. Tech stack: • Python • Streamlit • Supabase Still a work in progress with some rough edges, but already useful in my day-to-day. GitHub: https://lnkd.in/gNGA9akE #Python #Streamlit #DataScience #Supabase #BuildInPublic
To view or add a comment, sign in
-
-
𝙂𝙞𝙩 𝙘𝙤𝙢𝙢𝙖𝙣𝙙𝙨 𝙖𝙧𝙚 𝙚𝙖𝙨𝙮. 𝙂𝙞𝙩 𝙥𝙧𝙤𝙗𝙡𝙚𝙢𝙨 𝙖𝙧𝙚 𝙣𝙤𝙩. Everything works fine… until it breaks. And that’s where most developers get stuck. You can clone, commit, and push. But real challenges look like this: ➥ How do you pull without losing your work? ➥ How do you commit only what matters? ➥ How do you undo mistakes safely? ➥ How do you resolve conflicts cleanly? ➥ What do you do when your push gets rejected? This guide focuses on real Git problems you face daily and shows exactly what to do in each situation. Git isn’t about memorizing commands. It’s about knowing what to do when things go wrong. Doc Credit - Respective Owner ♻️ Repost if you found this useful 🤝 Follow Sattari Sateesh Kumar for more 👨💻 For 1:1 guidance → https://topmate.io/sateesh #python #pyspark #pysparklearning #dataengineering #sqllearning #dataengineeringinterview #azuredataengineer #bigdata #spark #datalearning #datacareer #azuredataengineering #dataengineeringjobs #linkedinlearning #dataengineeringlearning
To view or add a comment, sign in
-
💡 Solved “Remove Nodes From Linked List” Using a Stack — But Can It Be Better? Today I worked on the Remove Nodes From Linked List problem, and it was a fun one. 🔍 Problem Statement: Remove every node that has a node with a greater value somewhere to its right. Example: 5 → 2 → 13 → 3 → 8 ✅ Output: 13 → 8 ⚙️ My Approach: Stack I used a stack to maintain values in decreasing order: Traverse the linked list If current value is greater than stack top → pop smaller values Push current value Rebuild the linked list from remaining values ✨ Why it works: The stack keeps only values that are valid survivors after checking future nodes. 💻 🐍 Python code👍 🤩 👍: https://lnkd.in/gcAaycjY 📊 Complexity: Time: O(n) Space: O(n) 🧠 Takeaway: Sometimes using extra space makes the logic cleaner and easier to implement. But now I’m curious... 👉 Can you give the best solution for this problem? (Perhaps O(n) time with O(1) extra space?) Would love to see different approaches from the community 👇 #LinkedList #DataStructures #Algorithms #Python #CodingInterview #ProblemSolving #LeetCode Rajan Arora
To view or add a comment, sign in
-
-
🔁 𝗨𝗻𝗱𝗲𝗿𝘀𝘁𝗮𝗻𝗱𝗶𝗻𝗴 𝗟𝗶𝗻𝗸𝗲𝗱 𝗟𝗶𝘀𝘁 𝗥𝗲𝘃𝗲𝗿𝘀𝗮𝗹 — 𝟯 𝗔𝗽𝗽𝗿𝗼𝗮𝗰𝗵𝗲𝘀 (𝗣𝘆𝘁𝗵𝗼𝗻) Reversing a linked list is one of the most common DSA interview questions — but the real value comes from understanding how different approaches impact performance. I implemented three approaches to reverse a singly linked list: 𝗕𝗿𝘂𝘁𝗲 𝗙𝗼𝗿𝗰𝗲 (𝗨𝘀𝗶𝗻𝗴 𝗔𝗿𝗿𝗮𝘆) Store values in a list and reassign ⏱ Time: O(n) 🧠 Space: O(n) 𝗦𝘁𝗮𝗰𝗸 𝗔𝗽𝗽𝗿𝗼𝗮𝗰𝗵 Push nodes into a stack and reconnect ⏱ Time: O(n) 🧠 Space: O(n) 𝗢𝗽𝘁𝗶𝗺𝗮𝗹 𝗔𝗽𝗽𝗿𝗼𝗮𝗰𝗵 (𝗜𝗻-𝗽𝗹𝗮𝗰𝗲) 🚀 Reverse pointers without extra memory ⏱ Time: O(n) 🧠 Space: O(1) 𝗞𝗲𝘆 𝗟𝗲𝗮𝗿𝗻𝗶𝗻𝗴 💡 All approaches take the same time, but reducing space complexity from O(n) → O(1) makes the optimal solution industry-preferred. 𝗘𝘅𝗮𝗺𝗽𝗹𝗲 📌 Before → 10 → 20 → 30 After → 30 → 20 → 10 𝗧𝗲𝗰𝗵 𝗨𝘀𝗲𝗱 🔧 Python I’m currently exploring Data Structures, System Design, and scalable architectures. 📁 Code includes clean structure + documentation + complexity analysis https://lnkd.in/dTkpkwhY Would love feedback or suggestions from the community 🙌 #Python #DataStructures #LinkedList #DSA #CodingInterview #SoftwareDevelopment #Learning #GitHub
To view or add a comment, sign in
-
-
A Python function that checks stationarity across multiple financial symbols—a critical step anyone serious about algorithmic trading should master. Why does it matter? Many profitable strategies (mean reversion, pairs trading, cointegration) assume stationary data. If your underlying series is non-stationary (trending), your strategy will fail spectacularly. The approach: I'm using dual statistical tests—ADF and KPSS—because relying on just one can be misleading. Both must agree for a true verdict. What it does: ✓ Downloads price data from any symbol ✓ Tests both raw prices and log returns ✓ Returns p-values + actionable verdict ✓ Works with local CSV files too This is table-stakes for quant work. Whether you're building mean-reversion bots or testing factor strategies, validating stationarity upfront saves months of debugging DOA strategies. github: Chinedum14/Quant-Dev Happy building! 📈 #QuantTrading #AlgorithmicTrading #DataScience #Python #TimeSeries #SoftwareEngineering #Developer
To view or add a comment, sign in
-
Explore related topics
- Approaches to Array Problem Solving for Coding Interviews
- Leetcode Problem Solving Strategies
- LeetCode Array Problem Solving Techniques
- Common Algorithms for Coding Interviews
- Optimization Algorithms in Engineering
- Strategies for Solving Algorithmic Problems
- How to Improve Array Iteration Performance in Code
- Strategies For Code Optimization Without Mess
- Google SWE-II Data Structures Interview Preparation
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