LeetCode——Reverse String

Question

Write a function that takes a string as input and returns the string reversed.

Example:
Given s = "hello", return "olleh".

Answer

class Solution {
public:
    string reverseString(string s) {
        string str(s.rbegin(), s.rend());
        return str;
    }
};

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-06
  • 2021-07-04
  • 2021-11-27
  • 2021-08-03
猜你喜欢
  • 2021-04-24
  • 2022-02-12
  • 2021-07-11
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案