C++ solution provides a result in 38 secs! Less than a minute.