IntuitOA #6
Node Disconnection — Min Ops
估计困难评测数据准备中,可先阅读题面
考点(AI 标注)字符串动规
Secure a compromised communication network by disconnecting all nodes. There is a series of nodes (each represented by lowercase English letters) in a string. In a single operation, you can disconnect any number of adjacent nodes that are the same letter.
Determine the minimum number of operations required to disconnect all nodes and secure the network.
Example: s = "aabaa" → 2 (remove the run of a at the ends together via the middle, then remove b).