SOLUTION INFO
C++ · main.cpp
class Solution {
public:
int lengthOfLastWord(string s) {
int answer = 0, idx = s.size() - 1;
while(idx >= 0 && s[idx] == ' ') -- idx;
while(idx >= 0 && s[idx] != ' ') -- idx, ++ answer;
return answer;
}
};
SOLUTION DESCRIPTION
풀이 설명
등록된 풀이 설명이 없습니다.