🔥 Solved a classic Sliding Window problem today 👉 Find a subarray with given sum in O(n) time 💡 Idea: Expand window → add elements Shrink window → when sum exceeds target Stop when sum == target 🧠 Key Insight: Control the window based on sum, not size 🚀 Simple trick, powerful optimization! #DSA #Python #Coding #ProblemSolving #Learning
Optimizing Sliding Window Problem in O(n) Time
More Relevant Posts
-
Just built an Interactive Quiz Game Pro using Python and Gradio. Features: Multiple difficulty levels Real-time feedback with explanations Performance analytics (Bar & Pie Charts) Leaderboard system And here’s something important — I built this entire project on Google Colab, not on a high-end machine. In today’s era, you don’t need a powerful computer to build powerful projects — you need knowledge, consistency, and the right tools. Keep learning. Keep building. #Python #Gradio #BuildInPublic #CodingJourney #Students #Tech #Learning
To view or add a comment, sign in
-
🚀 Day 16 of #100DaysOfCoding Today I worked on pattern problems using Python, focusing on nested loops and condition logic. 🔹 Built a hollow square pattern using while loops 🔹 Strengthened understanding of loop control (i, j iterations) 🔹 Learned how to apply conditions for borders vs inner spaces 🔹 Practiced dry run techniques to debug and visualize code execution 💡 Key Learning: Breaking a problem into rows and columns makes pattern questions much easier to solve. The real trick is identifying where to print values and where to skip. Consistency is slowly turning confusion into clarity 💪 #Python #Coding #DSA #Programming #LearningJourney #Consistency n = int(input()) i = 1 while(i <= n): j = 1 while(j <= n): if(i == 1 or i == n): print("*", end="") elif(j == 1 or j == n): print("*", end="") else: print(" ", end="") j += 1 print("") i += 1
To view or add a comment, sign in
-
-
Check out my handbook "Fine-tuning Llama 3.2 model with LoRA" ❤️ If you are looking to fine-tune large language models efficiently, I just put together a comprehensive handbook breaking down the entire process using the Llama 3.2 - 1 billion parameter model and parameter-efficient LoRA technique! 🚀 #programming #coding #python
To view or add a comment, sign in
-
From “it works” to “it won’t break” While writing a code, Getting it to work is one thing, 𝗠𝗮𝗸𝗶𝗻𝗴 𝘀𝘂𝗿𝗲 𝗶𝘁 𝗱𝗼𝗲𝘀𝗻’𝘁 𝗯𝗿𝗲𝗮𝗸 is another. price = products["Laptop"] This works fine… until the 𝗸𝗲𝘆 𝗱𝗼𝗲𝘀𝗻’𝘁 𝗲𝘅𝗶𝘀𝘁 . That’s when the program crashes. So instead of assuming every piece of data is present, Its better to start thinking about what happens when it isn’t. In college projects, we often focus on making things work. In real-world scenarios, 𝗲𝗱𝗴𝗲 𝗰𝗮𝘀𝗲𝘀 matter just as much. 𝗗𝗮𝘆 𝟭𝟮/𝟯𝟬 #Python #LearningInPublic #Day12 #30DaysOfCode #SoftwareEngineering
To view or add a comment, sign in
-
Started moving from learning syntax to actually building logic. 🚀 Project: Number Guessing Game in Python Built an interactive game where the system generates a random number and provides hints (higher/lower) until the correct guess is made. 🔹 Concepts applied: • Random module • While loop for continuous interaction • Conditional logic (if-elif-else) • Attempt tracking 💡 Key learning: Even a simple project highlights the importance of writing correct logic and thinking step by step to improve user interaction. 📌 Focusing on consistency and improving with every project. #Python #CodingJourney #BeginnerProjects #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Can we actually enjoy studying? With the right approach, absolutely! 💡 I’ve been using a mix of my own notes and Generative AI to create visual summaries of Python basics. I found that using these visual "maps" makes it so much easier to remember terms properly for a long period of time. Whether you are a beginner or just need a quick revision guide, this 1-page summary is a game-changer for staying sharp. Check out my Python Basic "Cheat Sheet" below! 👇 #Python #GenAI #Programming #RevisionTips #CareerGrowth #DataScience #DataAnalytics
To view or add a comment, sign in
-
-
📌 Problem: Merge Strings Alternately 💡 Approach: Used a simple two-pointer / iteration technique to merge both strings character by character. First, iterate up to the minimum length of both strings and append alternately. Then, append the remaining characters from the longer string. ⚙️ Key Insight: Handle unequal string lengths separately Avoid index out-of-bounds by iterating till min(len(word1), len(word2)) ⏱️ Time Complexity: O(n + m) 📦 Space Complexity: O(n + m) merg 📚 What I learned: String manipulation efficiently Handling edge cases when lengths differ #LeetCode #DSA #Coding #ProblemSolving #Python #SoftwareDevelopment #CodingJourney
To view or add a comment, sign in
-
🚀 Stop writing the same code again and again; create a function once and reuse it forever! Function Creation Made Simple: Think of a function like a reusable recipe. Instead of cooking from scratch every time, you write the steps once and reuse them whenever needed. 👉 Example in Python: def greet(name): return f"Hello, {name}!" Now, calling greet("Aditi") instantly gives the following: Hello, Aditi! 🔑 Takeaway: Functions save time, reduce errors, and make your code cleaner. Write once, use forever. Catch you later. Stay tuned for more updates. #Coding #Python #LearningMadeSimple #Functions
To view or add a comment, sign in
-
-
Day 102 Backtracking patterns are starting to repeat. #Day102 🧩 90. Subsets II How today went: • Similar to the basic Subsets problem • Key difference: handling duplicates • Sorting the array is important • While iterating, skip duplicates to avoid repeating subsets What clicked: Backtracking becomes easier when you: • Recognize the base pattern • Add constraints like duplicate handling Same structure, new rule. That’s how patterns build. #LeetCode #DSA #Python #Backtracking #Recursion #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
Day 117 Same pattern, one important tweak. #Day117 🧩 90. Subsets II How today went: • Same base as Subsets • First step: sort the array • While iterating, skip duplicates to avoid repeating subsets • Use the same pattern: append → recurse → pop What I learned: It’s not a new problem — it’s the same pattern with a duplicate filter. Small condition. Big impact. Backtracking is starting to feel predictable. #LeetCode #DSA #Python #Backtracking #Recursion #LearningInPublic #Consistency
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