class Solution
{
public:
int finalPositionOfSnake(int n, vector<string>& commands)
{
int x = 0 , y = 0 ;
for(auto&str:commands)
{
if(str == "UP")
{
… else
{
y++;
}
}
return x*n+y;
}
};
leetcode 3248. 矩阵中的蛇
于 2024-11-21 21:30:51 首次发布