Dynamic proggramming

in maximum subarray sum can’t we use kadanes theorem to find max sum of subarray instead of dp.

Yes you can use Kadane as well. That will also work