Days 6/ 90: Structuring the Next Phase Took a quick breath to lock in core tree and graph traversals before shifting into higher gear. The technical breakdown: Evaluate Expression Tree: Straightforward post-order traversal (O(N) time / O(h) space). You evaluate the left and right subtrees recursively, then apply the parent node's operator (+, -, *, /) to the results. Closest Value in BST: Handled this iteratively to keep space complexity at O(1) constant instead of O(h) recursion stack frames. By exploiting the BST property, you eliminate half the remaining tree at each step, making it a clean O(log N) average-time operation. DFS on Graphs: Brushed up on standard adjacency list traversals, reinforcing the necessity of a visited set to prevent infinite cycles. The Self-Correction: I’ve noticed a pattern in my execution: I clear top-down structural problems (like expression trees), but bottom-up depth aggregations (like the Node Depths problem from Day 4) require a lot more mental friction. Identifying these blind spots early is exactly why I started this public log. The Strategy Pivot: The roadmap is changing. I’m going into a high-intensity DSA sprint for the next 4 days to completely clear out these structural blind spots. Once June hits, I’ll be balancing the daily DSA grind side-by-side with something new: building out a full-stack, real-time production project from scratch. Time to crank up the velocity. #DSA #ComputerScience #SoftwareEngineering #WebDevelopment
Structuring Next Phase of DSA Sprint
More Relevant Posts
-
Days 2 & 3 / 90: Mastering the Pointers. The last 48 hours have been a masterclass in pointer manipulation-specifically, how setting the right boundaries completely eliminates off-by-one errors and edge-case chaos. Here are the two core breakdowns: 1. Controlling Matrix Chaos with 4 Pointers (Day 2) Tackling matrix spiral traversal isn't about complex math; it's about strict spatial boundaries. By tracking 4 simple pointers (top, bottom, left, right), you can cleanly collapse the grid boundaries inward as you traverse: Move left to right along top -> top++ Move top to bottom along right -> right-- Move right to left along bottom -> bottom-- Move bottom to top along left -> left++ The Catch: You must check if your boundaries have crossed after every single direction change, not just at the end of the loop. Missing this breaks the logic instantly on non-square matrices. 2. The Universal Binary Search Template (Day 3) When searching a binary array (all 0s and 1s) for boundary conditions—like the first occurrence of 1-a completely uniform array (e.g., all 0s) usually requires messy internal if/else checks to avoid index errors. The elegant fix? Expand the initial search space to virtual boundaries: left = -1 and right = n By letting the pointers sit just outside the array indices, you can reuse a single, standard binary search template. Once the loop terminates: If left >= 0, you safely have your target. If right >= n, the element doesn't exist, handling the uniform edge case natively. Whether you are traversing inward on a 2D grid or expanding boundaries in a 1D array, clean code always comes down to how you manage your invariants. On to Day 4. #DSA #ComputerScience #SoftwareEngineering #ProblemSolving
To view or add a comment, sign in
-
Lurox 2.0 is here.. While everyone was vibe coding, I was reading CLRS at 2am trying to understand what actually happens when you hit search. 4-5 months of gathering knowledge. 2 months of execution. Last week, I showed you a search engine built in C from scratch. No libraries. O(1) lookup. Direct memory addressing. Sub-2ms latency. Curiosity doesn't stop at version 1. What got added: Semantic search — every question encoded into 384-dim vector space. Keywords don't matter. Meaning does. Cosine similarity finds what BM25 can't. Hybrid fusion — BM25 score + dense score, normalized, weighted by α. One number. Best of both worlds. RAG pipeline — top-5 results into Llama-3.3-70B. Grounded answer out. Doesn't know? It says so. No hallucination. Ever. 132 experiments. Found something nobody had measured before — result diversity peaks at α = 0.2–0.3. Not accuracy. Diversity. The point where hybrid search surfaces candidates neither BM25 nor semantic search could find alone. The numbers — → 0.17ms BM25 latency — C engine, untouched → Sub-17ms full hybrid pipeline → 4 retrieval modes — sparse, dense, hybrid, RAG → $0 infrastructure → Live. Right now. This is what happens when you don't stop at the textbook. Go break it. Try something weird. See what comes back. 🔗 lurox.netlify.app ⭐ https://lnkd.in/gQf-KC6n More incoming. #BuildInPublic #Research #InformationRetrieval #RAG #OpenSource
To view or add a comment, sign in
-
🚀 Blind 75 Journey Update – Phase 3 Completed (Sliding Window) I’ve successfully completed Phase 2: Two Pointers, and now I’ve moved through one of the most important interview patterns in DSA: 🔹 Phase 3 – Sliding Window (Completed) Problems covered: 1️⃣1️⃣ Longest Substring Without Repeating Characters (3) 1️⃣2️⃣ Longest Repeating Character Replacement (424) 1️⃣3️⃣ Minimum Window Substring (76) 💡 What I learned in this phase: This phase strengthened my understanding of one of the most powerful optimization techniques in arrays & strings: • Dynamic window expansion and contraction • Frequency tracking using HashMap / arrays • Maintaining optimal subarray/subsequence constraints • Handling real-time updates efficiently • Converting brute-force O(n²) → optimized O(n) solutions 🧠 Key Insight Sliding Window is not just a pattern — it's a mindset: Instead of recomputing, reuse previous computation while expanding and shrinking intelligently. It’s heavily used in: String processing problems Subarray optimization Streaming / real-time data problems 🎯 My Focus Moving Forward I’m continuing the Blind 75 journey in strict chronological order, focusing on: ✔ Pattern understanding before memorization ✔ Writing approach before coding ✔ Improving time & space optimization intuition ✔ Building strong DSA fundamentals step by step 🚀 Next Phase Coming Up: 🔹 Continuing Blind 75 with next patterns (Stack / Binary Search / Linked List depending on order) Consistency over speed. Depth over shortcuts. #Blind75 #SlidingWindow #DataStructures #Algorithms #LeetCode #CodingJourney #SoftwareEngineering #ProblemSolving #BuildInPublic #InterviewPreparation
To view or add a comment, sign in
-
🚀 Day 49/100 – #100DaysOfDSA Today’s problem was Search a 2D Matrix II, a classic that tests how well you can leverage sorted data for efficient searching. 🔍 Key Idea: The matrix is sorted: Rows → left to right Columns → top to bottom Instead of scanning everything, I used an optimized approach starting from the top-right corner. ⚡ Approach: Start at top-right element If current > target → move left If current < target → move down Repeat until found or out of bounds 🚀 Performance: ⏱️ Time Complexity: O(m + n) 💾 Space Complexity: O(1) ✅ Accepted with strong performance (~97% beats) 💡 What I learned: How sorted properties can eliminate large search spaces The power of directional traversal in matrices Thinking beyond brute force leads to elegant solutions 💭 Reflection: This problem is a great reminder that sometimes the best solution isn’t about doing more—it’s about moving smarter. Consistency continues 💪🔥 #DSA #100DaysOfCode #Matrices #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
If you're building a RAG system and retrieval feels imprecise, look at your chunking strategy before anything else. Three levels, from mechanical to principled: Level 1 — Structural: split by token count with overlap. Fast, predictable, no content awareness. A reasonable starting point. Level 2 — Contextual: respect meaning boundaries — conversation turns, topic shifts, speaker transitions. The cut happens where the content says it should, not where the token counter runs out. Level 3 — Ontological: chunks defined by knowledge architecture. A chunk = a meaningful unit of concept, entity, or relationship. Boundaries driven by taxonomy and information design, not text mechanics. This matters even more in GraphRAG. The chunking strategy directly shapes what entities and relationships the graph extractor can see — split across the wrong boundary and the connection disappears before the graph is even built. The retrieval layer can only find what the chunking preserved. #RAG #GraphRAG #AIEngineering #InformationArchitecture #KnowledgeGraphs #LLM #AIDesign
To view or add a comment, sign in
-
RAG and agent memory are not the same thing. Confusing them is how you end up with a vector DB for a 3-page FAQ. RAG (Retrieval-Augmented Generation) searches a document corpus at query time and injects retrieved chunks into the prompt. Agent memory stores and recalls session-specific context (e.g. what this user said, decided, or asked for previously). They solve different problems. RAG is for knowledge that's too large to fit in context (e.g. thousands of documents, live-updated content, knowledge shared across all users). Agent memory is for continuity, what this specific user prefers, decided, or worked through in previous sessions. The failure modes are opposite. Using RAG where you need memory adds 200-400ms retrieval latency and chunking overhead for something a simple episodic store handles in microseconds. Using memory where you need RAG gives you stale or missing knowledge that the model can't recover from. The third path gets missed most often: if your "knowledge base" is under 50 docs and changes quarterly, put it in the system prompt. No vector DB required. No retrieval latency. The engineering cost of standing up a RAG pipeline exceeds the value for small static corpora. In Promptise, vector memory (episodic and semantic) and RAG are separate subsystems (use either or both per agent). Where did you implement RAG and later realize agent memory or a prompt block would have been simpler? #AIEngineering #RAG #AgentMemory #LLMDevelopment
To view or add a comment, sign in
-
-
The last few weeks I went deep into RAG. It changed how I think about it. I used to think it was simple. Embed your docs, store them in a vector DB, retrieve the most similar chunks, pass them to an LLM. Done. It's not that simple. RAG is an architecture. The decisions you make at every step, how you chunk, how you index, how you retrieve, how you prompt, completely determine whether it works in production or just in a demo. What surprised me is how many forms it takes. Each one fixes a different failure. Embeddings miss exact keywords. BM25 catches them. Hybrid search solves this. Users rarely phrase questions the way documents are written. Query transformations close that gap. Small chunks retrieve well but give the LLM no context. Search small, return the full parent document. Not every question should hit the same index. Route first, then retrieve. When the answer lives across multiple entities, vectors are not enough. That is GraphRAG. The part nobody talks about enough: chunking and prompt design matter more than any of the above. Bad chunking breaks everything downstream. One sentence in your system prompt, something like "if the answer is not in the context, say so", is often the difference between a grounded system and one that hallucinates over its own retrieved documents. RAG went from tutorial project to production infrastructure in two years. Worth understanding the full picture. #RAG #LLM #AIEngineering #GenAI
To view or add a comment, sign in
-
-
Day 129: Layers, Rotations, and Time Travel ⏳🌀 Problem 1914: Cyclically Rotating a Grid Life got in the way today—traveling made it impossible to sit down and code in real-time. I had to use a "Time Travel" ticket to keep the streak alive. Not exactly how I wanted to hit Day 129, but the consistency remains unbroken. The Strategy: • Layer-by-Layer Extraction: I treated the grid like an onion, extracting each concentric layer into a linear 1D vector. • Optimized Rotation: Since rotating by K is redundant if K is larger than the layer size, I used K(modLayerSize) to skip unnecessary cycles. • Refilling the Grid: After shifting the 1D vector, I mapped the values back to their original boundary positions. C++ Implementation: I used a top, bottom, left, right pointer approach to traverse the boundaries of each layer. Transitioning this logic into C++ helped manage the vector pushes and indexing quite efficiently. Travel might have slowed me down, but the grind doesn't stop. Day 129—adapting and moving forward, no matter the schedule. 🚀 #LeetCode #Cpp #Algorithms #Matrix #ProblemSolving #DailyCode
To view or add a comment, sign in
-
-
Day 12 of #100DaysOfCode Solved: 1914. Cyclically Rotating a Grid 💡 Problem Idea: Rotate each layer of the matrix k times independently. 💡 Approach Step 1 Find all matrix layers (rings) Step 2 Extract each layer into a vector Step 3 Rotate the vector cyclically Step 4 Insert rotated elements back into the grid 🧠 Key Intuition: Instead of rotating the entire matrix directly, treat every boundary as a separate 1D circular array. 👉 Matrix problems often become easier after converting them into arrays. ⚡ Complexity: Each element is: visited once during extraction visited once during insertion ✅ Time Complexity: O(m × n) ✅ Efficient solution 📌 Takeaway: Complex matrix rotations become manageable by: Layer decomposition + array rotation #LeetCode #DSA #CodingInterview #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
If you think attention is just "weights that tell the model what to focus on," you're in good company. You're also missing the entire point. Here are the three mistakes that kept me debugging transformer implementations for weeks. ⚠️ The usual traps 🚨 Mistake 1: Thinking attention replaces embeddings You're calculating attention over word positions, not the actual semantic content. The query, key, and value matrices are all learned transformations of your embeddings. Without good embeddings feeding in, your attention scores are just fancy noise on garbage. ⚠️ Mistake 2: Ignoring the scaling factor You skip the sqrt(d_k) division because "it's just a constant." Then your softmax saturates, gradients vanish, and your model trains like it's 2015. That scaling isn't optional, it's literally preventing your dot products from exploding as dimensions grow. Use it. 🔧 Mistake 3: Confusing attention scores with what gets output The attention weights are just coefficients. You're still doing a weighted sum of the value vectors. I've seen people try to interpret a 0.8 attention score as "the model understands this token" when really it just means that value vector gets 80% weight in the final representation. 🔑 The one thing to keep Attention is a routing mechanism, not magic. It's matrix multiplication with extra steps and a softmax. Once I stopped treating it like a black box and actually printed out those QK^T matrices at different layers, everything clicked. #AttentionMechanism #TransformerArchitecture #DeepLearning #MachineLearning
To view or add a comment, sign in