leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

2490.cpp (335B)


      1 class Solution {
      2   public:
      3     bool isCircularSentence(const string &sentence) const {
      4         char prev = sentence.back();
      5         stringstream ss(sentence);
      6         string word;
      7 
      8         while (ss >> word) {
      9             if (word.front() != prev) return false;
     10             prev = word.back();
     11         }
     12 
     13         return true;
     14     }
     15 };