Implement `ds_algo_prob_40`. Libraries (NumPy, PyTorch, SciPy) are allowed, but Pure Python implementations earn bonus XP!
ds_algo_prob_40(*args, **kwargs)