Last week, I described four design patterns for AI agentic workflows that I believe will drive significant progress: Reflection, Tool use, Planning and Multi-agent collaboration. Instead of having an LLM generate its final output directly, an agentic workflow prompts the LLM multiple times, giving it opportunities to build step by step to higher-quality output. Here, I'd like to discuss Reflection. It's relatively quick to implement, and I've seen it lead to surprising performance gains. You may have had the experience of prompting ChatGPT/Claude/Gemini, receiving unsatisfactory output, delivering critical feedback to help the LLM improve its response, and then getting a better response. What if you automate the step of delivering critical feedback, so the model automatically criticizes its own output and improves its response? This is the crux of Reflection. Take the task of asking an LLM to write code. We can prompt it to generate the desired code directly to carry out some task X. Then, we can prompt it to reflect on its own output, perhaps as follows: Here’s code intended for task X: [previously generated code] Check the code carefully for correctness, style, and efficiency, and give constructive criticism for how to improve it. Sometimes this causes the LLM to spot problems and come up with constructive suggestions. Next, we can prompt the LLM with context including (i) the previously generated code and (ii) the constructive feedback, and ask it to use the feedback to rewrite the code. This can lead to a better response. Repeating the criticism/rewrite process might yield further improvements. This self-reflection process allows the LLM to spot gaps and improve its output on a variety of tasks including producing code, writing text, and answering questions. And we can go beyond self-reflection by giving the LLM tools that help evaluate its output; for example, running its code through a few unit tests to check whether it generates correct results on test cases or searching the web to double-check text output. Then it can reflect on any errors it found and come up with ideas for improvement. Further, we can implement Reflection using a multi-agent framework. I've found it convenient to create two agents, one prompted to generate good outputs and the other prompted to give constructive criticism of the first agent's output. The resulting discussion between the two agents leads to improved responses. Reflection is a relatively basic type of agentic workflow, but I've been delighted by how much it improved my applications’ results. If you’re interested in learning more about reflection, I recommend: - Self-Refine: Iterative Refinement with Self-Feedback, by Madaan et al. (2023) - Reflexion: Language Agents with Verbal Reinforcement Learning, by Shinn et al. (2023) - CRITIC: Large Language Models Can Self-Correct with Tool-Interactive Critiquing, by Gou et al. (2024) [Original text: https://lnkd.in/g4bTuWtU ]
Mastering Coding Challenges
Explore top LinkedIn content from expert professionals.
-
-
In the last 15 years, I have interviewed 800+ Software Engineers across Google, Paytm, Amazon & various startups. Here are the most actionable tips I can give you on how to approach solving coding problems in Interviews (My DMs are always flooded with this particular question) 1. Use a Heap for K Elements - When finding the top K largest or smallest elements, heaps are your best tool. - They efficiently handle priority-based problems with O(log K) operations. - Example: Find the 3 largest numbers in an array. 2. Binary Search or Two Pointers for Sorted Inputs - Sorted arrays often point to Binary Search or Two Pointer techniques. - These methods drastically reduce time complexity to O(log n) or O(n). - Example: Find two numbers in a sorted array that add up to a target. 3. Backtracking - Use Backtracking to explore all combinations or permutations. - They’re great for generating subsets or solving puzzles. - Example: Generate all possible subsets of a given set. 4. BFS or DFS for Trees and Graphs - Trees and graphs are often solved using BFS for shortest paths or DFS for traversals. - BFS is best for level-order traversal, while DFS is useful for exploring paths. - Example: Find the shortest path in a graph. 5. Convert Recursion to Iteration with a Stack - Recursive algorithms can be converted to iterative ones using a stack. - This approach provides more control over memory and avoids stack overflow. - Example: Iterative in-order traversal of a binary tree. 6. Optimize Arrays with HashMaps or Sorting - Replace nested loops with HashMaps for O(n) solutions or sorting for O(n log n). - HashMaps are perfect for lookups, while sorting simplifies comparisons. - Example: Find duplicates in an array. 7. Use Dynamic Programming for Optimization Problems - DP breaks problems into smaller overlapping sub-problems for optimization. - It's often used for maximization, minimization, or counting paths. - Example: Solve the 0/1 knapsack problem. 8. HashMap or Trie for Common Substrings - Use HashMaps or Tries for substring searches and prefix matching. - They efficiently handle string patterns and reduce redundant checks. - Example: Find the longest common prefix among multiple strings. 9. Trie for String Search and Manipulation - Tries store strings in a tree-like structure, enabling fast lookups. - They’re ideal for autocomplete or spell-check features. - Example: Implement an autocomplete system. 10. Fast and Slow Pointers for Linked Lists - Use two pointers moving at different speeds to detect cycles or find midpoints. - This approach avoids extra memory usage and works in O(n) time. - Example: Detect if a linked list has a loop. 💡 Save this for your next interview prep!
-
Most people don’t fail in DSA because it’s hard. They fail because they try to learn everything instead of learning the right patterns. If you’re a fresher preparing for coding interviews, stop collecting questions. Start mastering patterns. Here’s the exact roadmap I recommend 👇 1️⃣ Arrays Core patterns you must know: • Two Pointers • Sliding Window (fixed and variable) • Prefix Sum • Kadane’s Algorithm • Hashing / Frequency Map • Sorting + Greedy • Cyclic Sort • Binary Search 2️⃣ Linked Lists Core patterns: • Fast & Slow Pointer • Dummy Node • Reversal (entire list / k-group) • Merge Lists • Pointer Rewiring 3️⃣ Stack & Queue Core patterns: • Monotonic Stack • Monotonic Queue • Stack for Previous / Next Greater • Sliding Window + Deque 4️⃣ Trees & Graphs Core patterns: • DFS (pre / in / post order) • BFS (level order) • Recursion • Backtracking on Trees • Dijkstra • Topological Sort • Union Find 5️⃣ Advanced Patterns • Binary Search on Answer • Greedy • Dynamic Programming ◦ 0/1 Knapsack ◦ Unbounded Knapsack ◦ DP on Strings • Heap (Top K, Merge K) • Bit Manipulation You don’t need 1000 problems. You need clarity on these patterns. Once you understand the pattern, 10 different questions start looking the same. That’s when preparation becomes smart. If you’re preparing for placements or switching jobs, save this post and follow for more such content ❤️
-
𝐇𝐨𝐰 𝐦𝐮𝐜𝐡 𝐃𝐒𝐀 𝐢𝐬 𝐞𝐧𝐨𝐮𝐠𝐡 𝐭𝐨 𝐜𝐫𝐚𝐜𝐤 𝐌𝐢𝐜𝐫𝐨𝐬𝐨𝐟𝐭, 𝐆𝐨𝐨𝐠𝐥𝐞 𝐨𝐫 𝐖𝐚𝐥𝐦𝐚𝐫𝐭? This is the most common DM which I get from juniors are, "Ma’am, I’ve solved 300+ questions but still can’t solve new ones. How many do I really need to do?" When I started, I had the same doubt. Some seniors said 300 questions, others said 500+ to be safe. So I rushed to hit those numbers. But here’s the truth it’s not about the count, it’s about the patterns. Once you master patterns, every new problem feels familiar. Here are the 15 patterns you must know for placements: 1. 𝐓𝐰𝐨 𝐏𝐨𝐢𝐧𝐭𝐞𝐫 𝐓𝐞𝐜𝐡𝐧𝐢𝐪𝐮𝐞 – Solve pair/relationship problems in arrays/linked lists. 2. 𝐒𝐥𝐢𝐝𝐢𝐧𝐠 𝐖𝐢𝐧𝐝𝐨𝐰 – Efficiently handle subarray/substring problems. 3. 𝐇𝐚𝐬𝐡𝐢𝐧𝐠 / 𝐅𝐫𝐞𝐪𝐮𝐞𝐧𝐜𝐲 𝐂𝐨𝐮𝐧𝐭𝐢𝐧𝐠 – O(1) lookups for counts, duplicates, mapping. 4. 𝐏𝐫𝐞𝐟𝐢𝐱 𝐒𝐮𝐦𝐬 – Answer range queries fast. 5. 𝐁𝐢𝐧𝐚𝐫𝐲 𝐒𝐞𝐚𝐫𝐜𝐡 (𝐚𝐧𝐝 𝐯𝐚𝐫𝐢𝐚𝐧𝐭𝐬) – For sorted arrays or monotonic conditions. 6. 𝐆𝐫𝐞𝐞𝐝𝐲 – Local choices that lead to global solutions. 7. 𝐃𝐲𝐧𝐚𝐦𝐢𝐜 𝐏𝐫𝐨𝐠𝐫𝐚𝐦𝐦𝐢𝐧𝐠 – Break down overlapping subproblems. 8. 𝐁𝐚𝐜𝐤𝐭𝐫𝐚𝐜𝐤𝐢𝐧𝐠 – Explore all possibilities (subsets, permutations). 9. 𝐁𝐅𝐒 – Shortest paths, level-by-level traversals. 10. 𝐃𝐅𝐒 – Explore all paths, detect cycles. 11. 𝐇𝐞𝐚𝐩 / 𝐓𝐨𝐩-𝐊 – Manage largest/smallest efficiently. 12. 𝐌𝐞𝐫𝐠𝐞 𝐈𝐧𝐭𝐞𝐫𝐯𝐚𝐥𝐬 – Handle overlaps in schedules. 13. 𝐔𝐧𝐢𝐨𝐧-𝐅𝐢𝐧𝐝 – Manage connectivity in graphs. 14. 𝐓𝐫𝐢𝐞 – Prefix-based search and storage. 15. 𝐌𝐨𝐧𝐨𝐭𝐨𝐧𝐢𝐜 𝐒𝐭𝐚𝐜𝐤 / 𝐐𝐮𝐞𝐮𝐞 – Solve next/previous greater/smaller problems. And remember, DSA is not a sprint, it is a marathon. Rejections will happen, and that is normal. But every attempt makes you sharper, and every failure teaches you a pattern in life too. #DSA #Placements #CodingInterviews #ProblemSolving #CareerAdvice
-
Hard Truth: Data Structures - The Unavoidable Interview Reality Here's a pattern I've noticed recently that every software professional needs to hear: Even if you haven't used a binary tree in years, you WILL face data structure questions in your next interview. Here's why this matters: The Interview Reality Check: 1. FAANG-level companies: - Will absolutely grill you on data structures - Expect implementation from scratch - Want optimal solutions 2. Startups: - May seem more relaxed - Still include DS questions in their process - Use them to evaluate problem-solving 3. Even Frontend Roles: - React state management? That's a tree - Event handling? Welcome to queues - Browser history? That's a stack What I've Observed: - Brilliant developers failing interviews because they're rusty on basics - Senior engineers stumbling on LinkedList questions - Tech leads getting rejected for missing optimal solutions The Smart Approach: 1. Keep a "DS Emergency Kit": - Arrays & String manipulation - Hash Tables implementations - Tree traversals - Graph basics - Stack & Queue operations 2. Monthly Refresh Routine: - Solve one problem per structure - Review time complexities - Practice explaining your approach Common Mistakes: - Thinking "I don't use this at work, so I won't study it" - Starting interview prep too late - Focusing only on coding, ignoring theory Quick Tips: 1. LeetCode Medium is your friend 2. Always write clean code in interviews 3. Think aloud during problem-solving 4. Review basic implementations monthly Core Data Structures You MUST Know: 1. Arrays - What: Continuous memory blocks - Why: Foundation of most data operations - Real use: Instagram's photo feed, Spotify's playlist management 2. Linked Lists - What: Connected nodes with next/prev references - Why: Dynamic memory allocation - Real use: Undo/Redo functionality in text editors 3. Hash Tables - What: Key-value pair storage - Why: Lightning-fast O(1) lookups - Real use: Database indexing, caching systems 4. Stacks (LIFO) - What: Last-In-First-Out structure - Why: Track execution context - Real use: Browser history, Function call management 5. Queues (FIFO) - What: First-In-First-Out structure - Why: Order preservation - Real use: Print spoolers, Message queues in distributed systems 6. Trees - What: Hierarchical data structure - Why: Organized data relationships - Real use: File systems, DOM in web browsers 7. Graphs - What: Nodes connected by edges - Why: Complex relationship mapping - Real use: Social networks, Google Maps, Netflix recommendations 1. Practice implementing from scratch 2. Study time complexity for each operation 3. Learn when to use which structure Action Items: 1. Pick one structure weekly 2. Implement it in your preferred language 3. Solve 2-3 related problems 4. Document real-world applications
-
Your most talented software engineers left years ago, and they told their equally talented friends not to apply to your company. It hurts, but this is the impact of not creating a learning culture within your engineering organisation. As a leader, learning and growth needs to be your top priority. Ask your engineers: "what do they like about working here?". If "learning" is not mentioned, you have work to do! Some leaders believe that special days of learning are the way to do it - Hack days, learning days or “work on open source” day. I disagree. Those special days are fine, but it’s not enough. Learning needs to happen every day. Special days carved out for learning are also usually harder to do if you’re a middle or lower level manager. Don’t worry though, there are plenty of easy ways to incorporate learning into the daily job. Here are some methods I’ve used over the years that seemed to have worked well: 1. When you're kicking off something new, or you're thinking about refactoring something, don't just jump into building it. Ask your engineers to take a couple of days and have a go at a new stack, or a new way of doing something. Come back a few days later and compare solutions as a group. 2. Don't pre-assign tasks according to the strengths of a developer's current skill set. That just reinforces and deepens current skills, whilst other developers who've never worked in that stack or codebase will never have the opportunity to learn it. Instead, do the opposite! Assign tasks to the developer with the weakest skills in that space, or, at a minimum, randomize it. Continue to do that and the whole team will uplift together. 3. Create time in the plan to learn, incorporate it into estimations. If you’re doing point 2, you’re going to have the allow time for it because initially the team will slow down. If you're stepping into an unknown area as a team, it's a great learning opportunity! Make the most of it and carve out the right amount of time so that the team has the space to learn. 4. When you need to carve out dedicated time, tie it to a business objective. In point 3 above, those new unknowns are usually from a request to achieve a business outcome. Intentionally tie them together so that the learning achieves the business value. Of course, this means that relationship has to already exist. Your job is to make sure they stay connected and the value is known to stakeholders. 5. “Every day should be a learning day” say it to your team, often. Ask them to hold each other and you to account. Are you living up to that statement? Action things that get in the way of this being reality. 6. Hire growing learners and prioritise it over things like “experience with our stack”. You don’t actually need experience in your stack if you’re a sharp learner. Someone who has mastered the art of learning can be productive in something new in a week. I’m sure I’ve missed plenty of other methods. Share what you’ve seen work in the comments.
-
One of the persistent challenges in using large language models (LLMs) is getting them to follow instructions reliably — especially when the instructions are subtle or domain-specific. DeepMind’s latest research introduces Symbol Tuning, a simple yet powerful fine-tuning method that significantly improves an LLM’s ability to follow symbolic prompts (e.g., bullet points, XML, Markdown, or code-like instructions) in zero-shot and few-shot settings. https://lnkd.in/gzKDdHQ2 Why this matters: 🔹 Improves instruction following in GPT-class models 🔹 Works with tiny amounts of data (just 100K tokens!) 🔹 Boosts performance in math, code, and reasoning-heavy tasks 🔹 Enhances models' ability to generalize across symbolic formats This has massive implications for building enterprise agents, RAG pipelines, and developer copilots that need high-precision, structured interaction with users or data. A great reminder: sometimes, small, well-targeted innovations create massive gains. #LLM #InContextLearning #SymbolTuning #PromptEngineering #DeepMind #GenAI #AIResearch #InstructionFollowing #EnterpriseAI #DeveloperTools
-
Top 5 Must-Know DSA Patterns👇🏻👇🏻 DSA problems often follow recurring patterns. Mastering these patterns can make problem-solving more efficient and help you ace coding interviews. Here’s a quick breakdown: 1. Sliding Window • Use Case: Solves problems involving contiguous subarrays or substrings. • Key Idea: Slide a window over the data to dynamically track subsets. • Examples: • Maximum sum of subarray of size k. • Longest substring without repeating characters. 2. Two Pointers • Use Case: Optimizes array problems involving pairs or triplets of elements. • Key Idea: Use two pointers to traverse from opposite ends or incrementally. • Examples: • Pair with target sum in a sorted array. • Trapping rainwater problem. 3. Binary Search • Use Case: Efficiently solves problems with sorted data or requiring optimization. • Key Idea: Repeatedly halve the search space to narrow down the solution. • Examples: • Find an element in a sorted array. • Search in a rotated sorted array. 4. Dynamic Programming (DP) • Use Case: Handles problems with overlapping subproblems and optimal substructure. • Key Idea: Build solutions iteratively using a table to store intermediate results. • Examples: • 0/1 Knapsack problem. • Longest common subsequence. 5. Backtracking • Use Case: Solves problems involving all possible combinations, subsets, or arrangements. • Key Idea: Incrementally build solutions and backtrack when a condition is not met. • Examples: • N-Queens problem. • Sudoku solver. Why These Patterns? By focusing on patterns, you can identify the right approach quickly, saving time and improving efficiency in problem-solving.
-
I analyzed the top 50 coding interview questions, and they all boil down to these 18 patterns. People ask me how to crack technical interviews without spending years on LeetCode. My secret? I don't memorize solutions. People ask how I identify the right approach for a brand new problem instantly. My secret? I look for the underlying pattern, not the specific question. But the truth is... There is no secret. Just pure Pattern Recognition. To master DSA, you have to stop treating every problem as unique. You need to map them to these 18 fundamental branches. Here is the technical breakdown to get you started: 1. Optimization & Pointers - Two Pointers: Essential for sorted arrays and linked lists. Use this to detect cycles (Floyd's algorithm), remove elements, or find target pairs in O(N) time. - Sliding Window: The standard for subarray problems. Perfect for calculating running averages, finding the longest substring under constraints, or optimization within a linear data structure. - Intervals: When dealing with time ranges or overlaps, use Merge Intervals or Catalan logic. 2. Search & Traversal - Binary Search: Beyond finding numbers. Use on rotated sorted arrays or to find "first/last occurrence" boundaries in O(log N). - Tree Traversal: Master the recursion. Know when to use Level-order (BFS) vs. Pre/In/Post-order (DFS) for tasks like serialization or finding the Lowest Common Ancestor. - Graph Traversal: Solves island counting, cycle detection, and topological sorting. 3. Complex Structures & Logic - Heaps: The most efficient way to handle "Top K" elements, scheduling tasks, or finding medians in a data stream. - Tries: The go-to design pattern for autocomplete systems, spell checkers, and prefix searches. - Backtracking: For when you need all possibilities. Used in generating permutations, N-Queens, and Sudoku solvers. 4. The Heavy Hitters - Dynamic Programming (DP): For overlapping subproblems. Includes 1D/2D arrays, Longest Common Subsequence (LCS), and the Knapsack problem. - Graph Optimization (Union Find): Critical for network connectivity. Uses Disjoint Set Union and MST algorithms like Kruskal’s or Prim’s. Want to be a software engineer? Stop memorizing. Start recognizing. Remember, seeing the pattern is 90% of the solution. The code is just syntax. Which of these patterns do you find most difficult to implement? ♻️ Repost to help a connection ace their technical interview.
-
🤔 Why does it feel like I’m stuck after watching hours of coding tutorials? Here's the hard truth: Watching someone code is like watching someone swim. You'll never learn to float by sitting on the beach. 🧠 You don’t become a better programmer by watching. You become one by doing. → If you’re learning web development, are you building websites from scratch? → If you’re learning data science, are you playing with datasets? → If you’re learning software engineering, are you coding small tools? → If you’re learning the fundamentals, are you coding basic challenges? Not sure where to start? Here are some great platforms to find challenges for any programming path: 👩🏾💻LeetCode - For algorithm and coding challenges. https://leetcode.com/ 👩🏾💻 HackerRank - Solve problems and build domain skills. https://lnkd.in/es9Qb3Gc 👩🏾💻 freeCodeCamp - Build projects while learning. https://lnkd.in/euXPmkfx 👩🏾💻Frontend Mentor - Real-world web development challenges https://lnkd.in/eFH9qud6 👩🏾💻 Kaggle - Explore data science competitions. https://www.kaggle.com/ 👩🏾💻 Exercism - Great for language-specific practice https://exercism.org/ 👩🏾💻 Codewars - Fun, gamified learning. https://www.codewars.com/ 👩🏾💻 Edabit - Short, fun coding challenges. https://edabit.com/ Remember: Active learning is more effective than passive learning. A single hour of writing code teaches more than 10 hours of watching tutorials. Tackle challenges, no matter how small. 𝗖𝗼𝗱𝗲. 𝗠𝗮𝗸𝗲 𝗺𝗶𝘀𝘁𝗮𝗸𝗲𝘀. 𝗙𝗶𝘅 𝘁𝗵𝗲𝗺. 𝗥𝗲𝗽𝗲𝗮𝘁. What small project will you start coding today? 💻 What other coding platforms will you recommend? #Programming #Tech #Growth #LearnWithSofiat
Explore categories
- Hospitality & Tourism
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- 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
- Healthcare
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Career
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development