
[LeetCode/easy] Length of Last Word
·
알고리즘/LeetCode
https://leetcode.com/problems/length-of-last-word/ Length of Last Word - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com stringstream과 getline으로 문자열을 구분자로 구분해서 하려고 했는데, ex2에서 구분자 " "로는 안되길래 그냥 뒤에서부터 단어의 길이를 세줬다. int lengthOfLastWord(string s) { int answer = 0; for(int i=s.size()-1;..