055 I Coding - Method .sort_values() 🟩 #Technology #DataScience #Coding Method `.sort_values()`, to sort (order) dataframe based on column values. # Syntax dataframe = dataframe.sort_values(by=“column”) # Code accidentes_viales = accidentes_viales.sort_values(by=“FECHA”)
More Relevant Posts
-
26). 😊 🚀 LeetCode #283 – Move Zeroes | Two Pointers | C++ Solved LeetCode Problem 283, which focuses on in-place array manipulation using the Two Pointers technique. 🔍 Problem Overview Given an integer array nums, move all 0s to the end of the array while maintaining the relative order of the non-zero elements. 📌 Example Input: nums = [0,1,0,3,12] Output: [1,3,12,0,0] It uses two pointers: f (fast) scans through the array from left to right, and s (slow) tracks the position where the next non-zero element should be placed. As the fast pointer moves, whenever it encounters a non-zero value, that value is swapped with the element at the slow pointer’s position, and the slow pointer is then advanced. Zero values are simply skipped by the slow pointer and naturally end up toward the end of the array. By the time the fast pointer reaches the end, all non-zero elements have been shifted to the front in order, and all zeroes are moved to the back. ⚙️ Complexity Analysis ⏱ Time Complexity: O(n) 💾 Space Complexity: O(1) 📌 Language: C++ 📌 Platform: LeetCode #LeetCode #CPlusPlus #DSA #Arrays #TwoPointers #InPlaceAlgorithm #ProblemSolving #CodingPractice #CompetitiveProgramming #SoftwareEngineering #ComputerScience #CSStudents #BCA #BCAStudents #InterviewPreparation #DailyCoding #LearningToCode #DeveloperJourney #TechJourney #Consistency #CodingLife
To view or add a comment, sign in
-
-
#Day25of2026 | LeetCode Practice 📌 Problem: 416 – Partition Equal Subset Sum 🔗 Link : https://lnkd.in/giWhgucS 📚 Concept: Dynamic Programming, Subset Sum, 0/1 Knapsack 💡 Intuition: The array can be partitioned into two equal subsets only if the total sum is even. So the problem reduces to a classic question: 👉 Is there a subset whose sum equals totalSum / 2? This is exactly the Subset Sum problem. For each element, we have two choices: Take it into the subset Do not take it Using DP, we track whether a particular sum is achievable using the first i elements. The transition is straightforward: Either we already had the sum without the current element Or we include the current element and check if the remaining sum was achievable earlier Both memoization (top-down) and tabulation (bottom-up) efficiently solve the problem by avoiding repeated work. 🧠 Key Learning: Many partition problems reduce directly to the Subset Sum DP pattern. Early checks (like total sum being odd) can eliminate unnecessary DP computation. 📎 Sharing how recognizing the subset-sum structure simplifies the problem into a clean DP solution. https://lnkd.in/gwDn49KX #LeetCode #DSA #DynamicProgramming #SubsetSum #Consistency #LearningInPublic #LeetCodeDaily #JavaDSA
To view or add a comment, sign in
-
-
33). 😆 🚀 LeetCode #643 – Maximum Average Subarray I | Sliding Window | C++ Solved LeetCode Problem 643, which focuses on finding the maximum average of a fixed-length subarray using the sliding window technique. 🔍 Problem Overview Given an integer array nums and an integer k, the task is to find the maximum average value of any contiguous subarray of length k. 📌 Example Input: nums = [1,12,-5,-6,50,3], k = 4 Output: 12.75 First, it calculates the sum of the first `k` elements and stores it in `sum`, which also initializes `maxs` since this is the first possible window. Then, the loop continues from index `k` to the end of the array, sliding the window one step at a time: it adds the new element entering the window and removes the element leaving the window (`nums[i - k]`). After each shift, `maxs` is updated to store the maximum window sum seen so far. Finally, the function returns `maxs / k`, which gives the maximum average. -> This approach runs in **O(n)** time and uses **O(1)** extra space, making it efficient and optimal. ⚙️ Complexity Analysis ⏱ Time Complexity: O(n) 💾 Space Complexity: O(1) 📌 Language: C++ 📌 Platform: LeetCode #LeetCode #CPlusPlus #DSA #SlidingWindow #Arrays #TwoPointers #ProblemSolving #CodingPractice #CompetitiveProgramming #SoftwareEngineering #ComputerScience #CSStudents #BCA #MCA #BCAStudents #InterviewPreparation #DailyCoding #LearningToCode #DeveloperJourney #TechJourney #Consistency #CodingLife
To view or add a comment, sign in
-
-
New Year, new language?? 💎 Our 2026 Ruby Roadmap is here to take you from your first "Hello World" to advanced paradigms. We cover: ✅ Syntax Basics ✅ Object-Oriented Programming ✅ Data Structures & Algorithms ✅ Debugging & Testing Start your journey 👉 https://roadmap.sh/ruby
To view or add a comment, sign in
-
-
Day 12 Problem: Find Smallest Letter Greater Than Target (LeetCode – Easy) At first glance, this problem looks trivial — a sorted array and a target character. But the key idea lies in understanding lexicographical order and the wrap-around condition. Since the array is already sorted, we simply need to: Scan from left to right Return the first character strictly greater than the target If no such character exists, wrap around and return the first element No extra space. No complicated logic. Just clean thinking. Key learnings: Sorted input often allows early exits Wrap-around conditions are easy to miss Sometimes the simplest approach is the most optimal Approach: Traverse the array Return the first ch > target Else return letters[0] Time Complexity: O(n) Space Complexity: O(1) Code: https://lnkd.in/gaW6i7fA #DSA #ProblemSolving #LeetCode #CodingJourney #DailyPractice
To view or add a comment, sign in
-
-
🗓 Day 96 / 100 – #100DaysOfLeetCode 🔥 📌 Problem 3836: Maximum Score Using Exactly K Pairs Difficulty: Hard Today’s problem was a solid dynamic programming + optimization challenge. The task was to select exactly k pairs of indices from two arrays while preserving order, such that the sum of products of the chosen pairs is maximized. 🧠 Key Insight: This problem is essentially about choosing pairs in order, where each choice affects future possibilities. Brute force is impossible due to constraints — the solution requires DP with careful state transitions. 🧠 My Approach: Used Dynamic Programming, where the state represents: how many elements have been considered from both arrays how many pairs have already been formed At each step, had two choices: skip an element form a pair and add its product to the score Ensured: exactly k pairs are chosen index order is preserved in both arrays Tracked the maximum achievable score across all valid transitions. This structured DP approach ensures correctness even with large inputs. ⏱ Complexity: Time: Optimized DP (within constraints) Space: DP-based state storage 💡 Key Learning: ✔ transforming pair-selection problems into DP ✔ managing multi-dimensional states cleanly ✔ why “exactly k choices” often signals a DP solution ✔ Hard problems are all about modeling, not brute force 💪 Day 96 complete — only 4 days left to finish the 100-day journey! 🚀 #100DaysOfLeetCode #LeetCodeChallenge #ProblemSolving #DynamicProgramming #HardProblems #Optimization #Algorithms #DSA #CompetitiveProgramming #CodingJourney #LearningInPublic #KeepLearning
To view or add a comment, sign in
-
-
Day 11 of 100 Days of Coding #100Daysofcoding #coding #dsa 1.Encode and Decode Strings 2 pointers method: For encoding we need to make sure that we are adding the length of the string with the hash symbol as the delimiter and return a string For decoding We need to create an array res While loop starts from i=0 tell length of the entire string J starts from i We need to keep incrementing j until delimiter # is found Then find length of that string by substring i to j And appending from j+1 to the j+1+length of the string Increment i to j+1+length Code - class Solution: def encode(self, strs): res = "" for s in strs: res += str(len(s)) + "#" + s return res def decode(self, s): res = [] i = 0 while i < len(s): j = i while s[j] != '#': j += 1 length = int(s[i:j]) res.append(s[j+1 : j+1+length]) i = j + 1 + length return res Time Complexity- O(n) n = number of characters Space Complexity- O(n)
To view or add a comment, sign in
-
Day 36 of the LeetCode Daily Challenge ✅ Solved LeetCode 1653 – Minimum Deletions to Make String Balanced, a problem focused on string processing, greedy decision-making, and optimal state tracking. The goal was to ensure that all 'a' characters appear before any 'b' characters, while minimizing deletions. Rather than attempting brute-force deletions, I applied a greedy strategy with prefix/suffix reasoning, enabling an efficient single-pass solution. 🧠 Key Technical Insights: Used running counts to track the number of 'b' characters encountered so far Evaluated deletion trade-offs dynamically at each step Achieved an optimal O(n) time complexity with O(1) extra space Ensured correctness for large input sizes through constant-memory logic This problem reinforced the importance of simplifying constraints into maintainable states, a critical skill in real-world systems where efficiency and clarity matter. Continuing to build consistency through daily problem-solving, strengthening core fundamentals in algorithms, data structures, and clean logic design. #LeetCode #LeetCodeDaily #StringAlgorithms #Greedy #DataStructures #ProblemSolving #SoftwareEngineering #CodingPractice #ContinuousLearning #Python
To view or add a comment, sign in
-
-
#DAY76🚀 LeetCode Problem #1653 – Minimum Deletions to Make String Balanced 🧩 Problem Insight You’re given a string containing only ‘a’ and ‘b’. The string is considered balanced if no ‘b’ appears before an ‘a’. The task is to find the minimum number of deletions required to make the string balanced. 🧠 Core Idea As we scan the string: Count how many ‘b’ characters we’ve seen so far Whenever an ‘a’ appears after a ‘b’, we have two choices: delete this ‘a’, or delete one of the previous ‘b’s To minimize deletions, we greedily keep track of this balance and update the minimum operations required. ✨ Why This Approach Works Single pass traversal No extra data structures Greedy logic ensures optimal deletions 📊 Performance ⏱ Runtime: 288 ms 💾 Memory: 13.06 MB ✅ 157 / 157 testcases passed Small logic, powerful optimization — mastering patterns like this makes string problems much easier 💡 #LeetCode #DSA #GreedyAlgorithm #StringProblems #Python #ProblemSolving #100DaysOfDSA #CodingPractice #InterviewPrep #TechJourney #LearningEveryDay
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