dsa3 min read
Bit Manipulation — Master Recap & Cheatsheet
Complete bit manipulation cheatsheet: all critical tricks, bitmask DP patterns, XOR properties, complexity table, and problem index.
Read →
webcoderspeed.com
1276 articles
Complete bit manipulation cheatsheet: all critical tricks, bitmask DP patterns, XOR properties, complexity table, and problem index.
Master 1D DP: Fibonacci/Climbing Stairs, House Robber, LIS, Coin Change, Jump Game, and Kadane patterns with 5-language templates.
Count ways to climb n stairs taking 1 or 2 steps. Classic Fibonacci DP — dp[n] = dp[n-1] + dp[n-2] with O(1) space.
Find minimum cost to reach the top of stairs. Each stair has a cost; you can take 1 or 2 steps. DP: min cost to reach each stair.
Maximize amount robbed without robbing adjacent houses. Classic skip-one DP: dp[i] = max(dp[i-1], dp[i-2] + nums[i]).