leetcode 58. Length of Last Word

這道題主要要注意string 末尾有很多空格的情況,C++ 裏面空格的判斷是用單引號,順便學習一下revese 需要#include #include<algorithm> class Solution { public: int lengthOfLastWord(string s) { int num = s.size(); if (num==0)
相關文章
相關標籤/搜索