Run-time error on submission

Hi @mohammadabdullahjawwad
Your code is showing run time error because you are taking f[256] but remember a[i] can be greater than 256 so when for a[i] greater than 256 f[a[i]] gives run time error. Instead while taking input from user you should keep a track for max value of a[i] and then create f[max+1]={0}

Here is your corrected code :