Palantir posts strong Q2 as investors weigh rebound from 40% slide