Akhila Katragadda’s Post

🚀 Day 61 of My Python & DSA Journey Today I solved LeetCode 2089 — Find Target Indices After Sorting Array, a problem that focuses on counting and understanding sorting behavior efficiently. 🔍 Problem Solved: Given an array and a target value, return the indices of the target after sorting the array in non-decreasing order. 💡 Approach Used: Instead of actually sorting the array, I used an optimized counting approach: • Count numbers less than target • Count numbers equal to target • Generate indices based on these counts This avoids sorting and improves efficiency. ⚡ Key Learnings: • Optimizing without sorting • Counting-based logic • Understanding index positioning after sorting • Writing efficient solutions 📊 Complexity Analysis: ✅ Time Complexity: O(n) Single pass through the array ✅ Space Complexity: O(1) Only storing count variables 🎯 Why This is Efficient? Instead of sorting (O(n log n)), we solved it in linear time O(n). Under the Guidance of: Rudra Sravan kumar and Manoj Kumar Reddy Parlapalli #Day61 #Python #LeetCode #DSA #Algorithms #CodingJourney #100DaysOfCode #10000Coders 🚀

  • text

To view or add a comment, sign in

Explore content categories