NeetCode #805LC-2038MediumGreedy
← Back to All Problems

#805 · #2038 · Remove Colored Pieces if Both Neighbors are the Same Color(如果相邻两个颜色均相同则删除当前颜色)

📌 Problem Statement & Constraints

There is a row of pieces coloured A or B. Alice and Bob take turns (Alice first); a player removes one of their own pieces that has both neighbours the same colour. The player who cannot move loses. Return true if Alice wins. Constraints: 1 <= colors.length <= 10^5, colors[i] is A or B.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!