🔍 LeetCode 2900 - Longest Unequal Adjacent Groups Subsequence | C++ Recursion Solution Explained
In this video, we solve LeetCode Problem 2900: Longest Unequal Adjacent Groups Subsequence I using a clean C++ recursive approach. 💡
📌 Problem Summary:
You're given two arrays:
words (strings)
groups (integers)
Your goal is to return the longest subsequence of words where no two adjacent words belong to the same group.
🎯 What You’ll Learn in This Video:
How to think recursively for subsequence problems
Edge cases and correct index management in C++
Optimization tips for interview-style problems
🧠 Approach:
We build a result list recursively by checking whether adjacent groups are different — only then do we include the word in the result.
📘 C++ Topics Covered:
Vectors
Recursion
Condition checking
Clean code structure for interviews
✅ Don't forget to:
👍 Like
🔔 Subscribe
📝 Comment if you want the iterative version!
#LeetCode2900 #C++ #Recursion #CodingInterview #DSA #LeetCode #SubsequenceProblem