Handling Time Data: Logic over Strings. Today I worked on a common challenge: comparing time values like '7:15' and '10:30' stored in a list.The Problem: Standard string comparison can be unreliable (e.g., '7:15' vs '10:30'), and using float numbers leads to mathematical inaccuracies.The Solution: I converted all time entries into a single unit — Total Minutes from the start of the day (hours * 60 + minutes).This transformation turns time-strings into simple integers, creating a robust and scalable logic for sorting and filtering. A solid foundation is everything, whether it's infrastructure or code. 🛡️🦾#Python #Coding #ProblemSolving #SoftwareEngineering #Backend #Summerson
Comparing Time Values with Logic and Python
More Relevant Posts
-
Just shipped a new feature in my VS Code extension, CallFlow Tracer: automatic trace summarization. Performance traces usually give raw data, not answers. This feature turns complex call graphs into clear, actionable insights with one click. Identifies the slowest functions Shows exact time impact (percentages) Highlights bottleneck modules Suggests next optimization steps Provides complete trace statistics No more manually analyzing hundreds of nodes or guessing where the issue is. You get a clean summary of what to fix and why. Available now on the VS Code Marketplace — search “CallFlow Tracer”. What’s one performance insight you wish tools gave you automatically? #Python #VSCode #DeveloperTools #PerformanceOptimization #OpenSource
To view or add a comment, sign in
-
🚀 Day 39/60 — LeetCode Discipline Problem Solved: Sqrt(x) Difficulty: Easy Today’s challenge was to compute the square root of a number without using built-in functions. Instead of brute force, I used Binary Search — a classic, elegant approach that narrows down the answer efficiently. 💡 Key Learnings: • Binary Search application beyond arrays • Handling edge cases (x < 2) • Avoiding overflow using conditions carefully • Finding floor value of square root • Optimized thinking over brute force ⚡ Performance: Runtime: 4 ms Like walking in a foggy path, I didn’t see the answer directly… But step by step— cutting the search space in half— the truth revealed itself. That’s the beauty of algorithms. #LeetCode #60DaysOfCode #DSA #BinarySearch #ProblemSolving #CodingJourney #Python #Consistency #TechGrowth
To view or add a comment, sign in
-
-
🚀 Day 75 of #100DaysOfCode 🔥 LeetCode 179 – Largest Number 💡 Problem: Given a list of non-negative integers, arrange them such that they form the largest possible number. 🧠 Key Insight: Normal sorting won't work here ❌ We need a custom comparator based on string concatenation. 👉 Compare: - ""a + b"" vs ""b + a"" - Whichever gives a larger value should come first. ⚙️ Approach: 1. Convert numbers to strings 2. Sort using custom comparison logic 3. Join the result 4. Handle edge case (like "[0,0] → "0"") ⚡ Complexity: - Time: O(n log n) - Space: O(n) 🎯 Result: ✅ Accepted ⚡ Runtime: 0 ms (100%) 📌 Lesson Learned: Sometimes sorting logic depends on combination, not value. #LeetCode #Python #CodingJourney #DSA #100DaysOfCode #Sorting #ProblemSolving
To view or add a comment, sign in
-
-
✅ Day 98 of 100 Days LeetCode Challenge Problem: 🔹 #338 – Counting Bits 🔗 https://lnkd.in/gXdNxX66 Learning Journey: 🔹 Today’s problem focused on counting the number of 1s in the binary representation of numbers from 0 to n. 🔹 I initialized an array ans of size n+1. 🔹 For each number i, I converted it to binary using bin(i)[2:]. 🔹 Counted the number of '1' bits by iterating through the binary string. 🔹 Stored the count in ans[i] and returned the final array. Concepts Used: 🔹 Bit Manipulation (Binary Representation) 🔹 Array Traversal 🔹 String Processing 🔹 Brute Force Approach Key Insight: 🔹 Each number’s bit count can be computed independently. 🔹 Converting to binary and counting '1' works, but can be optimized further using DP or bit tricks. Complexity: 🔹 Time: O(n log n) (binary conversion for each number) 🔹 Space: O(n) #LeetCode #Algorithms #DataStructures #100DaysOfCode #Python #CodingJourney #ProblemSolving #LearningInPublic
To view or add a comment, sign in
-
-
How an EXCAVO indicator goes from idea to TradingView: Hypothesis — "Does this concept have an edge?" Research — study the mechanics, find the data Build — write the code, test on charts Backtest — Python, historical data, multiple markets Kill or ship — most ideas die here The 27 indicators on our TradingView survived this process. The strategies we run privately survived even more. We don't publish things we wouldn't use ourselves. #Trading #SystematicTrading #Process
To view or add a comment, sign in
-
𝗗𝗮𝘆 𝟲𝟴/𝟳𝟱 | 𝗟𝗲𝗲𝘁𝗖𝗼𝗱𝗲 𝟳𝟱 𝗣𝗿𝗼𝗯𝗹𝗲𝗺: 136. Single Number 𝗗𝗶𝗳𝗳𝗶𝗰𝘂𝗹𝘁𝘆: Easy 𝗣𝗿𝗼𝗯𝗹𝗲𝗺 𝗦𝘂𝗺𝗺𝗮𝗿𝘆: Given a non-empty array where every element appears twice except for one, find the element that appears only once. Constraints: • Linear time complexity required • Constant extra space 𝗠𝘆 𝗔𝗽𝗽𝗿𝗼𝗮𝗰𝗵: This problem is efficiently solved using Bit Manipulation (XOR operation). • Key Properties of XOR: – a ^ a = 0 – a ^ 0 = a – XOR is commutative and associative • Logic: – XOR all elements in the array – Duplicate numbers cancel each other out – The remaining value is the unique element • Implementation: – Initialize a variable (e.g., result = 0) – Traverse the array and XOR each element with result – Final result holds the single number This works because pairs eliminate themselves, leaving only the non-repeating number. 𝗖𝗼𝗺𝗽𝗹𝗲𝘅𝗶𝘁𝘆 𝗔𝗻𝗮𝗹𝘆𝘀𝗶𝘀: • Time Complexity: O(n) • Space Complexity: O(1) 𝗞𝗲𝘆 𝗧𝗮𝗸𝗲𝗮𝘄𝗮𝘆: Bit manipulation can simplify problems that seem to require extra space. XOR is especially powerful when dealing with pairs or duplicates. 𝗤𝘂𝗲𝘀𝘁𝗶𝗼𝗻 𝗟𝗶𝗻𝗸: https://lnkd.in/guP-fJnC #Day68of75 #LeetCode75 #DSA #Java #Python #BitManipulation #Algorithms #MachineLearning #DataScience #ML #DataAnalyst #LearningInPublic #TechJourney #LeetCode
To view or add a comment, sign in
-
-
Code that writes code. 🌌 There is a point in every developer's journey where you stop thinking about Logic and start thinking about Patterns. Advanced Python is about: ~Abstraction: Using Protocols and Generics for structural typing. ~Automation: Using advanced Decorators to inject behavior across entire systems. ~Reliability: Understanding the memory manager so you can prevent leaks before they start. We use these "hidden" features not to make the code more complex, but to make the usage of our code more simple for everyone else. Which part of the "Advanced Mindset" was the hardest for you to learn? For me, it was finally mastering asyncio flow control. #CleanCode #Pythonic #ProgrammingPrinciples #SystemDesign #AdvancedCoding
To view or add a comment, sign in
-
-
LeetCode Problem 380 Insert Delete GetRandom O(1): "Implement the RandomizedSet class: RandomizedSet() Initializes the RandomizedSet object. bool insert(int val) Inserts an item val into the set if not present. Returns true if the item was not present, false otherwise. bool remove(int val) Removes an item val from the set if present. Returns true if the item was present, false otherwise. int getRandom() Returns a random element from the current set of elements (it's guaranteed that at least one element exists when this method is called). Each element must have the same probability of being returned. You must implement the functions of the class such that each function works in average O(1) time complexity." Approach: Maintain two data structures one hash_table to get elements in constant time and other a list so that getRandom() function can be implemented by using random.choice(list). Time Complexity: O(1) Space Complexity: O(n) #Python #LeetCode #DSA #Algorithms #HashTable #Lists #Arrays #OptimalSolution #DataStructures
To view or add a comment, sign in
-
-
Vector databases are great, but they aren't always the right tool for complex document intelligence. 🧠📉 If you are tired of context fragmentation and untraceable LLM hallucinations, it is time to look at Vectorless RAG with Page Index. By swapping out mathematical embeddings for a reasoning-based, hierarchical document tree, you can achieve upwards of 98% accuracy on complex Q&A tasks with perfect citation traceability. I wrote a complete guide on how this architecture works, including a full Python code implementation. Read it here: https://lnkd.in/gRuXiSxK #ArtificialIntelligence #RAG #PythonDeveloper #MachineLearning #AIEngineering
To view or add a comment, sign in
-
-
Your calendar-based model retraining schedule is probably broken. We proved it by analyzing 555,000 fraud cases. The classic "forgetting curve" theory didn't fit the data at all. Models in production don't forget gradually; they get shocked by sudden changes in the real world. Retraining on a fixed schedule misses these shocks entirely. The fix? Shift from time-based to shock-detection monitoring. Build systems that trigger retraining when data patterns fundamentally break, not when the calendar says so. Read more: https://lnkd.in/gjmhnm_X What practical tools are you using for this? #MachineLearning #Python #DataAnalytics #TechTrends Auto-generated post — I built the agent behind this in n8n. Want one? DM me ✉️
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