🚀 Day 6 of #100DaysOfCode: Mastering SymmetryToday’s focus was all about efficiency in string manipulation! I tackled the Longest Palindromic Substring challenge, moving beyond brute force to a more optimized approach.🧠 Key Takeaways:Algorithmic Logic: Implemented the Expand Around Center algorithm. By treating each character (and the space between characters) as a potential center, I achieved $O(n^2)$ time complexity with $O(1)$ space—much better than the $O(n^3)$ brute-force method!Version Matters: Had a quick "debug moment" with a Python SyntaxError. It was a great reminder to ensure the environment is set to Python 3 when using modern features like type hinting (s: str -> str).Full-Stack Mindset: Solving these logic puzzles helps me write cleaner, more efficient functions for my current projects, like the ResolveIT Smart Grievance System and the UniPass UI.
Mastering Symmetry in Code: Longest Palindromic Substring Challenge
More Relevant Posts
-
Claude can write a compiler, but it can't spell "anthropic" backwards. I tested it: pure LLM: "cipohtrpna" => wrong. Give it a sandbox? It writes `echo "anthropic" | rev`, runs it, gets "ciporhtna." => correct 10 tests where LLMs fail: counting, reversal, prime factorization, set ops. No sandbox: 8/10. With sandbox: 10/10. I didn't tell it to write code, it just recognized what it's bad at and reached for Python! Anthropic just shipped Programmatic Tool Calling (Claude writes code that calls your tools). Fewer round-trips, less tokens. It runs in their container, not yours. Testing it, something occurred to me: does that still work without tools? Yes, and it patches its own blind spots with code! Have you tried PTC already? #AICoding #ClaudeCode #AIAgents #LLM
To view or add a comment, sign in
-
-
✓ Week 8 Complete Tests that scale. This week was about pytest advanced - fixtures, parametrization, scopes, and conftest.py. The stuff that turns a handful of tests into hundreds. Built parametrized-test-suite - a scalable test suite for evaluating LLM responses across multiple scenarios. Why this matters for GenAI testing: → LLMs handle infinite input variations → You can't write a separate test for every prompt → Parametrization lets you test hundreds of inputs with one test function What clicked this week: → Fixtures = reusable setup, not copy-paste → Scopes control when setup runs (function, class, module, session) → @pytest.mark.parametrize = one test, many inputs → conftest.py = shared fixtures across all tests Phase 0 (Python Foundation) - COMPLETE. ✅ 8 weeks. 8 mini-projects. Foundation laid. Next up: Phase 1 - LLM Fundamentals. Time to understand what I'm actually testing. Code's in the repo - link in comments. #GenAITesting #LearnInPublic #Python #pytest #LLMTesting
To view or add a comment, sign in
-
🎯 Markets are dynamic. Static optimization can't keep up.\n\nRL frames portfolio allocation as an MDP: state → action → reward → learn π(a|s).\n\nMarkowitz gave us mean-variance. RL gives us adaptive decision-making.\n\nFull implementation with Python code + backtest results:\nhttps://lnkd.in/eH6Wm4-A #RL #PortfolioOptimization #MachineLearning #Trading
To view or add a comment, sign in
-
-
🚀 𝗕𝗼𝗼𝘀𝘁 𝗣𝘆𝘁𝗵𝗼𝗻 𝗧𝗲𝘀𝘁 𝗤𝘂𝗮𝗹𝗶𝘁𝘆 𝘄𝗶𝘁𝗵 𝗜𝗻𝗹𝗶𝗻𝗲 𝗦𝗻𝗮𝗽𝘀𝗵𝗼𝘁𝘀 Writing expected values by hand in tests can be repetitive and fragile — especially with complex output. Inline snapshot testing in pytest changes that. Instead of writing expected output manually, you can: ✅ Write your assertion once ✅ Run pytest --inline-snapshot=fix ✅ Auto-generate expected snapshots inside your test 𝗘𝘅𝗮𝗺𝗽𝗹𝗲: from inline_snapshot import snapshot def test_create_user(): result = create_user(name="alice") assert result == snapshot({}) } Now run: ✅ 𝗽𝘆𝘁𝗲𝘀𝘁 --𝗶𝗻𝗹𝗶𝗻𝗲-𝘀𝗻𝗮𝗽𝘀𝗵𝗼𝘁=𝗳𝗶𝘅 …and it auto-fills: assert result == snapshot({ "id": 42, "name": "alice", "created_at": "2026-02-19T12:00:00Z" }) This approach makes snapshot tests cleaner, easier to maintain, and flexible. #Python #pytest #Testing #SnapshotTesting #DeveloperTools
To view or add a comment, sign in
-
🚀 LeetCode Practice 📌 Problem: Number of Steps to Reduce a Number in Binary Representation to One 🔗 LeetCode Problem #1404 🧠 Problem Statement Given a binary string s, return the number of steps required to reduce it to "1" using: ✅ If the number is even → divide it by 2 ✅ If the number is odd → add 1 It is guaranteed that we can always reach "1". 🔎 Example Input: s = "1101" Output: 6 Explanation: 13 (1101) → +1 → 14 14 → /2 → 7 7 → +1 → 8 8 → /2 → 4 4 → /2 → 2 2 → /2 → 1 💡 Key Insight The length of s can be up to 500 bits, so converting directly to an integer might not be ideal in some languages. Instead, we: Traverse from right to left Simulate division and addition Maintain a carry variable Count operations efficiently ⚡ Optimized Approach (Greedy + Carry Handling) 🔥 Core Observations If last bit is '0' → number is even → 1 step (divide) If last bit is '1' → number is odd → 2 steps (add 1 + divide) Handle carry propagation carefully 🧑💻 Python Implementation (O(n) Time | O(1) Space) class Solution: def numSteps(self, s: str) -> int: steps = 0 carry = 0 # Traverse from right to left (ignore MSB) for i in range(len(s) - 1, 0, -1): bit = int(s[i]) # If bit + carry == 1 → odd if bit + carry == 1: steps += 2 carry = 1 else: steps += 1 return steps + carry 📊 Complexity Analysis ⏱ Time Complexity: O(n) 📦 Space Complexity: O(1) Where n is the length of the binary string. #LeetCode #ProblemSolving #Python #DSA #CodingInterview #BitManipulation #TechGrowth
To view or add a comment, sign in
-
-
The "No API" Excuse is Dead 🚫 "Sorry, that system is too old. It doesn't have an API." I hear this in meetings all the time. It usually means a project is dead in the water. But here is the truth: If it has a user interface, it has an API. It's just an API designed for humans, not computers. The Inputs: Text boxes and buttons. The Outputs: Screen text and tables. With Python and Playwright, we can turn that "Legacy User Interface" into a structured, programmable API. We don't need to wait for a digital transformation project. We can build the bridge today. #LegacySystems #API #Python #Playwright #DigitalTransformation Truly yours Bot.
To view or add a comment, sign in
-
❄️ takeUforward — Day 38 ✅ A Number After a Double Reversal | Number Manipulation | LeetCode Today I worked on a number manipulation problem involving reversing digits twice and checking if the result equals the original number. 💡 Problem Statement Given an integer "num", reverse the number twice and check whether the final value is equal to the original number. 🧠 Approach • Store the original number. • Reverse the number using modulo ("% 10") and division ("// 10"). • Reverse the result again. • Compare the final value with the original number. 🐍 Python Code class Solution: def isSameAfterReversals(self, num: int) -> bool: orginal = num sum_ = 0 sum2 = 0 while num > 0: last_digit = num % 10 sum_ = (sum_ * 10) + last_digit num //= 10 while sum_ > 0: lsd = sum_ % 10 sum2 = (sum2 * 10) + lsd sum_ //= 10 return True if sum2 == orginal else False ⏱ Complexity • Time: O(d) — where d is number of digits • Space: O(1) 📌 Key Learning Reversing numbers using digit extraction helps build strong fundamentals in number-based algorithms and edge case handling. 🚀 Day 38 completed — improving number manipulation skills step by step. #Python #DSA #LeetCode #ProblemSolving #CodingJourney #LearningInPublic #100DaysOfCode
To view or add a comment, sign in
-
-
✨ Day 8 of #GeekStreak60 Today’s Problem of the Day focused on determining whether two strings are Isomorphic. 🔍 Problem Statement Given two strings s1 and s2 of equal length, check whether they are isomorphic. Two strings are isomorphic if: • Each character in s1 maps to exactly one character in s2 • The mapping is consistent and preserves order • No two characters in s1 map to the same character in s2 💡 Approach ✔️ Compared the pattern of first occurrences in both strings ✔️ Used list comprehension with index() to capture structural patterns ✔️ Verified if both patterns match — ensuring isomorphism 🚀 Key Insight Instead of directly mapping characters, comparing structural patterns simplifies the solution and keeps the code clean and efficient. 🎯 Outcome Clean logic ➝ Minimal code ➝ Maximum clarity 📈 Progress Update Day 8 completed successfully! Consistency is the key to building strong problem-solving skills 💪 #GeeksforGeeks #GeekStreak60 #Day8 #ProblemSolving #Python #CodingJourney #NPCI
To view or add a comment, sign in
-
-
Day 48 of Solved: 696. Count Binary Substrings on LeetCode Today’s challenge was a perfect reminder that great solutions come from great observations, not longer code. 💡 Problem Insight We need to count substrings that: ✔ Contain equal number of 0’s and 1’s ✔ Have all 0’s together and all 1’s together At first glance, the brute-force approach (checking all substrings) looks tempting… but that leads to O(n²) ⛔ — not scalable for large inputs. ⚡ Optimization Thought Process Instead of generating every substring: ✨ Count consecutive groups of 0’s and 1’s ✨ Compare adjacent groups ✨ Add min(previous_group, current_group) This transforms the solution into: 🚀 Time Complexity → O(n) 🚀 Space Complexity → O(1) Efficient, clean, and interview-ready. 🧠 What I learned today 🔹 How powerful pattern recognition is in DSA 🔹 Converting brute force → optimal approach 🔹 Writing logic that works for large constraints 🔹 Importance of dry running on examples 🔹 Thinking in terms of groups instead of substrings #Day48 LeetCode #DSA DataStructure Technologies #CodingChallenge PROBLEMSOLVING Python CodeEveryDay LearnInPublic
To view or add a comment, sign in
-
-
Run agent run! Long-context reasoning = reliable agents. It's one in the same. A reliable agent must be able to process and manage the information it encounters. Wether you’re building an agent to solve a three step process (that probably could be a python script) or a complex task that spans hundreds of steps, context management determines how your system makes decisions, how and when it calls tools to interact with the world, and how long it’s able to run before failing entirely. An agent able to reason over long context is a reliable agent. Of course, this is a key focus at Subconscious, with context management hard wired into both the models and the runtime that compose our agent engines.
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