How to solve Distinct Sums?

Anyone who solved it, please give a baby editorial for this?

It is very easy to solve what we can do is that checking three conditions

Case 1:- if(max value<min value) ans is 0
Case 2:- if (n==1)
if(max value!=min value) ans is 0 else ans is 1
Case 3 else case then the answer is that all sums betweeen max value +(n-1)*min value and min_value+ (n-1)*max_value both the values inclusive you can dry and run and get it yourself now
solution link.

solution link


Thank You very much!:heart: