Skip to content

Latest commit

 

History

History

faulty-keyboard

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Faulty keyboard

Problem link

Solutions

Solution.cpp

// https://leetcode.com/problems/faulty-keyboard/

class Solution {
 public:
  string finalString(string s) {
    string ret;
    for (char c : s) {
      if (c == 'i')
        reverse(ret.begin(), ret.end());
      else
        ret += c;
    }
    return ret;
  }
};

Tags