📌 Problem. no 179: Given a list of non-negative integers, arrange them such that they form the largest possible number. Solved using a custom comparator to sort numbers based on concatenation order and achieve the optimal result. ⚡ Runtime: 3 ms – Beats 78.56% of submissions 💾 Memory: 12.69 MB – Beats 24.66% of solutions 💻 Language Used: Python ✅ Status: Accepted – All 235 test cases passed successfully! This problem enhanced my understanding of string-based comparison, custom sorting, and optimization through logic-based ordering. It’s an elegant challenge that blends sorting and string manipulation seamlessly. 🔑 Key Learnings: ✔️ Learned how to design and implement custom comparators ✔️ Understood how concatenation order affects numeric outcomes ✔️ Strengthened my grasp on sorting logic and greedy approaches 🎯 Day 84 — A creative challenge that refined my problem-solving through custom sorting and logical structuring! 🚀🔥 #100DaysOfCode #100DaysOfDSA #LeetCode #PythonProgramming #DataStructures #AlgorithmPractice #CodeNewbie #DailyCoding #ProblemSolving #TechJourney #WomenWhoCode #CodeLife #CodingChallenge #DSAChallenge #DeveloperLife #PythonDeveloper #LearnToCode #CodingCommunity #CodeEveryday #SoftwareEngineering #KathirCollegeOfEngineering #KathirCollege #BTechLife #AIDS #FutureEngineer #CodingMotivation #ProgrammingSkills
Solved LeetCode problem 179 with custom comparator in Python
More Relevant Posts
-
⚡ Day 83 of #100DaysOfDSA – Majority Element 💡 📌 Problem. no 169: Given an array nums, find the element that appears more than ⌊n / 2⌋ times. Implemented an efficient hash map-based counting approach to track element frequency and determine the majority element quickly. ⚡ Runtime: 13 ms – Beats 37.81% of submissions 💾 Memory: 13.60 MB – Beats 64.79% of solutions 💻 Language Used: Python ✅ Status: Accepted – All 53 test cases passed successfully! This challenge helped me better understand frequency counting, dictionary operations, and threshold-based decision making. It’s a great problem for mastering counting logic and handling arrays efficiently. 🔑 Key Learnings: ✔️ Strengthened my understanding of hash maps and element frequency counting ✔️ Learned how to use early termination for optimization ✔️ Improved confidence in solving majority and occurrence-based problems 🎯 Day 83 — A solid step forward in mastering counting logic and data structure efficiency! 🚀🔥 #100DaysOfCode #100DaysOfDSA #LeetCode #PythonProgramming #DataStructures #AlgorithmPractice #CodeNewbie #DailyCoding #ProblemSolving #TechJourney #WomenWhoCode #CodeLife #CodingChallenge #DSAChallenge #DeveloperLife #PythonDeveloper #LearnToCode #CodingCommunity #CodeEveryday #SoftwareEngineering #KathirCollegeOfEngineering #KathirCollege #BTechLife #AIDS #FutureEngineer #CodingMotivation #ProgrammingSkills
To view or add a comment, sign in
-
-
🔥 Day 96 of #100DaysOfDSA – Power of Three 💡 📌 Problem. no 326: Check if a given number is a power of 3. If it is, return True; otherwise, return False. Simple yet elegant number theory logic at play. 🚀 Runtime: 11 ms – Beats ⚡61.54% of Python submissions 💾 Memory: 12.45 MB – Beats 51.93% 💻 Language: Python ✅ Result: Accepted – 21,040 / 21,040 test cases passed! 🔑 Key Learnings ✔️ Efficient looping and modular arithmetic can reveal hidden mathematical patterns ✔️ Edge cases (like n <= 0) must always be handled carefully ✔️ Clean, readable code performs just as powerfully as optimized code 🎯 Day 96 — Mathematics + Logic = Pure Programming Magic ✨ #100DaysOfCode #100DaysOfDSA #LeetCode #PythonProgramming #DataStructures #AlgorithmPractice #CodeNewbie #DailyCoding #ProblemSolving #TechJourney #WomenWhoCode #CodeLife #CodingChallenge #DSAChallenge #DeveloperLife #PythonDeveloper #LearnToCode #CodingCommunity #CodeEveryday #SoftwareEngineering #KathirCollegeOfEngineering #KathirCollege #BTechLife #AIDS #FutureEngineer #CodingMotivation #ProgrammingSkills
To view or add a comment, sign in
-
-
🔁 Day 45 of #100DaysOfDSA — Reverse Linked List Problem: Reverse Linked List (LeetCode #206) Given the head of a singly linked list, reverse it and return the reversed list. Concepts Used: 🧠 Stack-based approach Traverse the linked list and push each node’s value into a stack. Then reassign values by popping from the stack to reverse the list. 🧩 Learning Reflection: This problem helped me understand how stacks can simplify linked list manipulations. Though not the most space-efficient solution, it reinforces the concept of LIFO (Last In, First Out) operations beautifully. ⏱️ Complexity: Time: O(N) Space: O(N) 💬 Closing Thought: Sometimes, using an extra data structure makes logic clearer — and that’s okay while learning. #LeetCode #DSA #LinkedList #Python #100DaysOfCode #CodingJourney
To view or add a comment, sign in
-
-
🔥 Day 94 of #100DaysOfDSA – First Bad Version 🧩 📌 Problem. no 278: Find the first bad version in a sequence of software versions using minimal API calls. 🚀 Runtime: 11 ms – Beats ⚡86.79% of Python submissions 💾 Memory: 12.47 MB – Beats 49.90% 💻 Language: Python ✅ Result: Accepted – 24 / 24 test cases passed successfully This challenge was a neat application of binary search to minimize API queries and optimize decision-making over large datasets. 🔑 Key Learnings ✔️ Efficient mid-point calculation prevents overflow in large searches ✔️ Binary search is a timeless and versatile tool ✔️ Understanding search space optimization enhances overall coding logic 🎯 Day 94 — Debug less, think binary, and aim for precision! ⚙️📈 #100DaysOfCode #100DaysOfDSA #LeetCode #PythonProgramming #DataStructures #AlgorithmPractice #CodeNewbie #DailyCoding #ProblemSolving #TechJourney #WomenWhoCode #CodeLife #CodingChallenge #DSAChallenge #DeveloperLife #PythonDeveloper #LearnToCode #CodingCommunity #CodeEveryday #SoftwareEngineering #KathirCollegeOfEngineering #KathirCollege #BTechLife #AIDS #FutureEngineer #CodingMotivation #ProgrammingSkills
To view or add a comment, sign in
-
-
Day 39 / 100 – Combination Sum (LeetCode #39) Today’s challenge was Combination Sum, a classic problem that teaches how to explore all possible combinations that add up to a target. The key idea here is recursion with backtracking — trying different paths, and “undoing” choices when they don’t lead to a solution. At first, it felt complex to keep track of combinations without duplicates, but recursion made it elegant once I understood how to structure the calls properly. It’s a great example of how backtracking mirrors human problem-solving: try, fail, and refine until success. 🔍 Key Learnings Recursion helps break complex problems into smaller, reusable patterns. Backtracking avoids unnecessary computation by pruning invalid paths early. Always remember to copy the current combination when adding it to results — lists are mutable! 💭 Thought of the Day Sometimes the most powerful solutions come from simplicity — recursion mirrors the way we naturally think through problems step by step. Today’s problem reminded me that patience and clarity often lead to clean, beautiful solutions ✨ 🔗 Problem Link: https://lnkd.in/gxtE573Z 🏷️ #100DaysOfCode #Day39 #LeetCode #Python #Recursion #Backtracking #ProblemSolving #Algorithms #DataStructures #CodingChallenge #LearnToCode #CleanCode #MindsetMatters #CodeEveryday #TechJourney
To view or add a comment, sign in
-
-
⏳ Leetcode #1611: Minimum One Bit Operations to Make Integers Zero 🔍 Today I picked up a problem that looked chaotic at first: transforming any integer into zero using very restricted bit-flip rules. Every bit could only flip if the bits below it satisfied certain conditions, making the process feel unpredictable 🧩. But once I dug deeper, something interesting appeared. The pattern wasn’t random at all; it was secretly following Gray Code. That realization turned a confusing sequence of operations into a clean, structured transformation ✨. ✅ Key Insight: The number of operations directly aligns with converting a Gray-Code-like representation of n into its binary form. ✅ Time Complexity: O(log n) ✅ Space Complexity: O(1) These are the moments that make problem solving rewarding: when the “why is this so messy?” suddenly becomes “this is actually lowkey clean” 🧠💡. #DataStructures #LeetCode #CodingChallenge #ProblemSolving #Python #DSA #ComputerScience #learningEveyDay
To view or add a comment, sign in
-
-
🚀 DSA Challenge – Day 101 Problem: Maximum Number of Operations on Binary String ⚙️💡 This problem was an elegant mix of string traversal and logical counting, where understanding the movement of '1's relative to '0's was key to finding the optimal number of operations. 🧠 Problem Summary: You are given a binary string s. You can repeatedly perform the following operation: Choose an index i where s[i] == '1' and s[i + 1] == '0'. Move '1' right until it reaches the end or another '1'. Your goal → Return the maximum number of operations that can be performed. ⚙️ My Approach: 1️⃣ Traverse the string from left to right. 2️⃣ Maintain two counters: ones → counts the number of '1's encountered so far. res → stores the total number of operations. 3️⃣ Every time a '0' is found after some '1's, we can perform operations equal to the number of '1's seen so far. 4️⃣ Continue counting consecutive zeros and repeat the process. 💡 Why This Works: Each '1' can “influence” all the zeros that appear after it — moving right across them. Hence, for every block of zeros, we add all previously counted ones to our result. 📈 Complexity Analysis: Time Complexity: O(n) → Single pass through the string. Space Complexity: O(1) → Constant extra space. ✨ Key Takeaway: Sometimes, all it takes is counting relationships instead of simulating moves — a simple greedy insight leading to an optimal O(n) solution. ⚡ 🔖 #DSA #100DaysOfCode #Day101 #LeetCode #ProblemSolving #GreedyAlgorithm #StringManipulation #Python #CodingChallenge #TechCommunity #EfficientCode #LearnByDoing
To view or add a comment, sign in
-
-
💡 Day 43 / 100 – Search in Rotated Sorted Array (LeetCode #33) Today’s problem was a twist on the classic binary search — quite literally! The challenge was to find a target element in a rotated sorted array. At first glance, the array looks unsorted, but there’s actually a pattern. By identifying which part of the array is properly sorted at every step, we can still apply binary search logic efficiently — achieving O(log n) time complexity. This problem beautifully blends pattern recognition with logical precision. 🔍 Key Learnings Even when data looks “unsorted,” patterns often exist beneath. Modified binary search can adapt to many problem variations. Understanding midpoint relationships helps in avoiding brute force. 💭 Thought of the Day Adaptability is key — in coding and in life. Just like binary search adjusts to a rotated array, we can adjust to challenges by recognizing the underlying order in the chaos. Clear logic turns confusion into clarity. 🔗 Problem Link: https://lnkd.in/gS8FcbeE #100DaysOfCode #Day43 #LeetCode #Python #BinarySearch #ProblemSolving #Algorithms #CodingChallenge #DataStructures #CodingJourney #PythonProgramming #LogicBuilding #KeepLearning #TechGrowth #Motivation
To view or add a comment, sign in
-
-
🚀 𝐃𝐚𝐲 𝟏𝟑 𝐨𝐟 #𝟏𝟔𝟎𝐃𝐚𝐲𝐬𝐎𝐟𝐂𝐨𝐝𝐞 — 𝐏𝐚𝐥𝐢𝐧𝐝𝐫𝐨𝐦𝐞 𝐍𝐮𝐦𝐛𝐞𝐫 | 𝐒𝐭𝐫𝐢𝐧𝐠𝐬 🧩 Today’s focus was on a simple yet classic logic check — determining if a number reads the same forward and backward. While it looks straightforward, it’s a great reminder that elegant solutions often come from clarity, not complexity. Problem: 𝐂𝐡𝐞𝐜𝐤 𝐢𝐟 𝐚𝐧 𝐢𝐧𝐭𝐞𝐠𝐞𝐫 𝐢𝐬 𝐚 𝐩𝐚𝐥𝐢𝐧𝐝𝐫𝐨𝐦𝐞. Approach: Convert the integer to a string and compare it with its reverse. Time Complexity: O(n) Space Complexity: O(n) This small exercise reinforces foundational reasoning that scales up when designing more complex systems — where reversing, mirroring, or symmetry detection shows up in data validation, pattern recognition, and even natural language tasks. 🔗 GitHub: https://lnkd.in/gaim_PJS #Python #LeetCode #CodingChallenge #160DaysOfCode #ProblemSolving #DSA #AIEngineerJourney
To view or add a comment, sign in
-
🔹 Day 5 of 30 – LeetCode Challenge: Longest Increasing Subsequence 📈 Today’s problem was all about finding patterns and optimizing logic! I solved the Longest Increasing Subsequence (LIS) problem — a fundamental concept in Dynamic Programming and Binary Search optimization. 🧩 Problem: Given an array of integers, find the length of the longest subsequence where each element is strictly greater than the previous one. Example: Input: nums = [10,9,2,5,3,7,101,18] Output: 4 Explanation: [2,3,7,101] is the longest increasing subsequence. 💡 Approach: There are two ways to solve this: 1. Dynamic Programming (O(n²)) a. For each element, look back at all previous elements. b. Update dp[i] as the length of the LIS ending at that index. 2.Binary Search Optimization (O(n log n)) a. Maintain a list sub representing potential increasing subsequences. b. Use bisect_left to replace elements efficiently. ⚙️ Complexity: Time: O(n log n) Space: O(n) 🏆 Result: ✅ All test cases passed ⚡ Optimized solution using Binary Search 💪 Strengthened understanding of Dynamic Programming and Binary Search combination 💬 Learning: This problem helped me understand how to convert a quadratic DP approach into a logarithmic one by thinking about sorted subsequences and binary search placements — a powerful pattern for future optimization problems. #Day5 #LeetCode #DynamicProgramming #BinarySearch #Python #Algorithms #DataStructures #30DaysOfCode #MTech #CodingChallenge #LIS
To view or add a comment, sign in
-
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