Using C++ to check if string s is subsequence of string t
using namespace std is considered bad practice.  Also, in C++, you should #include &lt;string&gt; rather than #include &lt;string.h&gt;.

The Solution class is an unnecessary complication.  You would be better off with just an isSubsequence() function.

In your first function, returnVal is never used.  Compiling with warnings enabled should alert you to the dead code.

The memory management rule is simple: every new must be paired with exactly one delete, and every new something[] must be paired with exactly one delete[].  Since the first solution calls new[] twice with no delete[], you have a memory leak.  Your friend is right: you should take advantage of the string class, because the whole point of the string class is to take care of memory management for you.  The second solution is definitely better.

The function signature is not ideal.  Having string parameters will cause each string to be needlessly copied when the function is called.  You should write instead:

bool isSubsequence(const std::string &amp;s, const std::string &amp;t) {
    …
}


std::string::size() returns std::string::size_type, so strictly speaking, you should use std::string::size_type instead of int.  (Or, if using c++11, just use auto.)