Re: [闲聊] 每日leetcode

楼主: sixB (6B)   2024-12-05 10:20:26
2337. 推推乐
遇到机器人脸 '_' 就可以推
L向左推 R向右推
把start 推成target
class Solution {
public:
bool canChange(string start, string target) {
int l = 0, r = 0;
int n = start.length();
// push L
for(int i = 0; i < n; i++){
if(target[i] == 'L') l++;
if(start[i] == 'R' and l > 0) return false;
if(start[i] == 'L') l

Links booklink

Contact Us: admin [ a t ] ucptt.com