Add another C++ solution

avoids dynamic allocation!