
#Full Stack Development | MERN | NextJs | Typescript | Python | OpenAI | BuildInPublic | Open Source | #100DaysOfCode
Joined January 2023
- Tweets2.3K
- Following270
- Followers517
- Likes6.7K
DevVortex retweeted
You don't need to know everything to be a developer.
You need just enough knowledge to ask the right questions and make meaningful progress.
🚀 #LeetCode POTD (Day 74) ✅
💡 Approach (Bit Manipulation) :
1️⃣ In a circular XOR, original[0] repeats twice, so XOR of all derived must be 0.
2️⃣ Compute XOR of all derived elements.
3️⃣ Return true if XOR == 0, else false.
2
74
🚀 #LeetCode POTD (Day 73) ✅
💡 Approach (Bit Manipulation)
1️⃣ Elements with even frequency cancel out: x ^ x = 0
2️⃣ If nums1.size() is odd, XOR all elements of nums2.
3️⃣ If nums2.size() is odd, XOR all elements of nums1.
4️⃣ Return the final XOR result.
2
51
🚀 #LeetCode POTD (Day 72) ✅
💡 Approach (Bit Manipulation)
1️⃣ Count set bits in num1 & num2 using __builtin_popcount().
2️⃣ If num1 has fewer set bits, turn on unset bits from LSB.
3️⃣ If num1 has more set bits, turn off set bits from LSB.
2
68
🚀 #LeetCode POTD (Day 66) ✅
Counting Words With a Given Prefix
💡 Approach (String Matching)
1️⃣ Loop through the words, check if each starts with the prefix using starts_with().
2️⃣ Increment a counter for each match and return the total.
2
39
🚀 #LeetCode POTD (Day 65) ✅
💡 Approach (Brute Force)
1️⃣ For each word pair (i, j) where i < j, check if the first word is both a prefix and suffix of the second.
2️⃣ Use find and rfind to verify prefix-suffix match.
3️⃣ Count and return total valid pairs.
3
47
🚀 #LeetCode POTD (Day 62) ✅
Shifting Letters II
💡 Approach (Difference Array Pattern)
1️⃣ Build difference array for range shifts.
2️⃣ Compute cumulative shifts with prefix sum.
3️⃣ Apply mod 26 to handle shifts (negative/large), wrapping 'a' to 'z' accordingly.
6
66
🚀 #LeetCode POTD (Day 61) ✅
💡 Approach (Set + Two Pointers)
1️⃣ Identify first & last occurrence of each character.
2️⃣ Collect unique middle characters for valid ranges.
3️⃣ Return the count of unique palindromic subsequences.
2
33
🚀 #LeetCode POTD (Day 59) ✅
Count Vowel Strings in Ranges
💡 Approach (Prefix Sum)
1️⃣ Count words starting & ending with vowels, storing cumulative counts
2️⃣ For each query, use pf_sum[r] - pf_sum[l-1] formula
3️⃣ Store results for all queries
1
49
🚀 #LeetCode POTD (Day 56) ✅
💡 Approach (Dynamic Programming)
1️⃣ Start recursion with curr_len = 0, check bounds [low, high], set addOne = true if valid
2️⃣ Count ways via recursive calls for take_one & take_zero
3️⃣ Return addOne + take_one + take_zero (total ways)
2
68
🚀 #LeetCode POTD (Day 55) ✅
💡 Approach (Dynamic Programming)
1️⃣ Precompute freq for char counts at each column in words
2️⃣ Use recursion + memoization to find ways to form target[i] starting from column j
3️⃣ Either skip or use column j, ensuring results are modulo 1e9 + 7
1
3
61
🚀 #LeetCode POTD (Day 52) ✅
Target Sum
💡 Approach (DP)
1️⃣ Use recursion with memoization to explore adding/subtracting nums[ind].
2️⃣ Handle negatives by offsetting currSum with S = sum(nums).
3️⃣ Store results in dp[ind][currSum + S] to avoid recomputation and optimize.
1
1
57
🚀 #LeetCode POTD (Day 51) ✅
Find Largest Value in Each Tree Row
💡 Approach (Simple BFS)
1️⃣ Apply plain BFS to traverse the tree level by level.
2️⃣ At each level, store the maximum value in the result vector.
4
59
🚀 #LeetCode POTD (Day 50) ✅
Find Minimum Diameter After Merging Two Trees
💡 Approach (BFS)
1️⃣ Compute diameters (d1, d2) of both trees using BFS.
2️⃣ Merged diameter: max(d1, d2, ⌈d1/2⌉ + ⌈d2/2⌉ + 1).
3️⃣ BFS twice finds the farthest nodes to calculate tree diameter.
3
69
🚀 #LeetCode POTD (Day 47) ✅
Maximum Number of K-Divisible Components
💡 Approach (DFS)
1️⃣ Perform a DFS traversal to compute subtree sums.
2️⃣ If a subtree sum is divisible by k, it forms a valid component.
3️⃣ Increment component count (ans) and reset sum for that subtree.
3
64















