Solved the classic Two Sum problem today using Python. Instead of using the brute-force approach (O(n²)), I optimized it using a HashMap and reduced the time complexity to O(n). 🧠 Key Learnings: • Think beyond brute force * Use HashMaps for constant-time lookup * Strong fundamentals come from consistent practice Sharing my implementation on GitHub. #Python #DSA #ProblemSolving #AI #MachineLearning #Coding https://lnkd.in/gWGSyu9V
Optimized Two Sum Problem with Python HashMap
More Relevant Posts
-
Machine Learning Text Data using the fuzz #machinelearning #datascience #textdata #thefuzz FuzzyWuzzy is a Python library for fuzzy string matching that uses Levenshtein Distance to compare two strings and returns a similarity score from 0 to 100. https://lnkd.in/g7YhU-Mh
To view or add a comment, sign in
-
Today I explored the power of the Pandas library in Python 🐼📊 Before learning Pandas, handling data using basic Python was possible — but it required more lines of code and effort. With Pandas, tasks like reading data, filtering rows, calculating averages, and analyzing datasets become much simpler and more efficient. Here’s a small comparison I practiced today 👇 🔹 Without Pandas: More loops, manual calculations, and longer code. 🔹 With Pandas: Cleaner, faster, and more readable code. Pandas truly makes data manipulation easy and powerful for data analysis. #Python #Pandas #DataScience #LearningJourney #BTechCSE
To view or add a comment, sign in
-
-
I built a Python script that organized my entire Downloads folder in under 3 seconds. Here's the embarrassing truth : my Downloads folder had 100+ files. PDFs, random images, zip files, old code. All just sitting there. A complete mess. So instead of cleaning it manually (again), I wrote a Python script to do it for me. What it does: → You point it at any folder → It scans every file → Sorts them into Images, Videos, Documents, Code, Archives → Shows a preview before touching ANYTHING → Logs every move with a timestamp What I learnt building this: → pathlib makes file/folder handling so much cleaner than I expected → sys.exit() is how you kill a program gracefully instead of just crashing → mkdir() creates folders on the fly if they don't exist in a single line The part I'm most proud of is that it asks for confirmation before moving anything, so you never accidentally mess something up. Full code on GitHub: https://lnkd.in/gCwyzJAv 🤘 #Python #Automation #7DaysOfPython #100DaysOfCode
To view or add a comment, sign in
-
The best debugging session is a build. Recently put together a small project using Python and Pandas. What it forced me to think through: 🔹 Structuring DataFrames for the right operations — not just loading data, but designing it 🔹 Vectorized operations over loops — cleaner, faster, more Pythonic 🔹 Filtering, grouping, and aggregating with intent 🔹 Serialization — reading from and writing back to files mid-workflow 🔹 Knowing when Pandas is the right tool and when it's overkill That last point is underrated. A DataFrame isn't always the answer. Knowing when a plain Python dict does the job better — that's the actual skill. Real constraints teach what tutorials skip. #Python #Pandas #DataEngineering #BuildingInPublic #SoftwareCraft #DataScience
To view or add a comment, sign in
-
🚀 Day 50 of My Python Journey Today I solved Complement of Base 10 Integer on LeetCode. 🔍 Problem Overview: The task is to find the bitwise complement of a given base-10 integer. The complement is obtained by flipping all bits in its binary representation — changing every 0 to 1 and every 1 to 0. 🧠 Approach: 1️⃣ Convert the integer into its binary representation. 2️⃣ Traverse the binary string and flip each bit (1 → 0, 0 → 1). 3️⃣ Convert the resulting binary string back to a decimal integer. ⚡ Key Learnings: • Practiced binary representation and bit manipulation • Improved understanding of number systems (binary ↔ decimal) • Strengthened string manipulation and logical thinking in Python 📊 Complexity: • Time Complexity: O(n) • Space Complexity: O(n) Under the Guidance of : Rudra Sravan kumar and Manoj Kumar Reddy Parlapalli #Day50 #Python #LeetCode #DataStructures #Algorithms #CodingJourney #ProblemSolving #100DaysOfCode 🚀
To view or add a comment, sign in
-
-
Solved the "Valid Parentheses" problem today using Python. Instead of checking every combination, I used a Stack data structure to track opening brackets and ensure they close in the correct order. Key Learnings: * Stack is very useful for matching problems * Clean logic improves efficiency * Consistent practice strengthens fundamentals GitHub: https://lnkd.in/gWGSyu9V Time Complexity: O(n) Sharing my implementation on GitHub. #Python #DSA #ProblemSolving #Coding #MachineLearning
To view or add a comment, sign in
-
🐍 Your All-in-One Python Syntax Cheat Sheet When I started learning Python, I kept Googling the same small syntax again and again That’s when I realized how powerful a well-structured cheat sheet can be. This Python Syntax Cheat Sheet covers everything you need to build a strong foundation: ☑️ Basic Syntax — print, variables, type casting ☑️ Data Structures — lists, tuples, sets, dictionaries ☑️ Control Flow — if-else, loops, break & continue ☑️ Functions & Lambdas 📌 Whether you're a beginner or a data professional, this is a must-have reference. Follow Rohit Kushwaha for more valuable content #Python #DataScience #DataEngineering #CheatSheet #Pandas
To view or add a comment, sign in
-
Just launched: Open Telemetry in Python — Part 1 If you've ever stared at logs at 2 AM wondering "which" service broke and "why" — this tutorial is for you. Part 1 covers the foundations: → What observability actually is (and how it differs from monitoring) → The three pillars: Traces, Metrics, and Logs → What OpenTelemetry is — and what it isn't → Your first instrumented Python app with real spans No fluff. Just clear explanations, working code, and a cheat sheet you'll actually use. 📖 Read it free at www.getspanforge.com 🔗 https://lnkd.in/geWXMD2w Parts 2–6 (Flask, Jaeger, Prometheus, the Collector) are coming soon. Follow along if you don't want to miss them. Share your comments, thank you. #OpenTelemetry #Python #Observability #SoftwareEngineering #DevOps
To view or add a comment, sign in
-
Automatic machine learning using pycaret #datascience #machinelearning #automl #pycaret #datavisualization Pycaret is an open source, low code machine learning library in python that automates machine learning workflows. https://lnkd.in/g2b_5wTd
To view or add a comment, sign in
-
Day 15/100: My code finally talked back! 🎙️✨ For two weeks, I’ve been talking at my computer. Today, it started listening. I mastered the input() function! The Catch: Python is a bit of a literalist. If you tell it you’re 25, it thinks you’re the word "25," not the number. Without Type Casting (int()), your math becomes a mess. It's the difference between "25 + 1 = 26" and "25 + 1 = 251." 🤦♂️ The Code: Python name = input("Enter your name: ") age = int(input("Enter your age: ")) # Casting to int so Python doesn't get confused print(f"Hi {name}! {age} is a great age to master Python. 🚀") Moving from static scripts to interactive tools feels like a massive level-up. ⬆️ #100DaysOfCode #Python #InteractiveCode #CodingLife #LearnToCode
To view or add a comment, sign in
-
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
Optimized using HashMap for O(n) time complexity. Open to suggestions and feedback.