naive version
naive version and divide&conquer