Https://online.codingblocks.com/player/16664/content/5364?tab=submissions

https://online.codingblocks.com/player/16664/content/5364?tab=submissions
i think this is similar to k pass of selection sort but it is giving wrong answer

Mention screenshot of question.

please tell my mistake where i am going wrong .

@Himanshu-Kashyap-635252480157924 save your code on ide and share here so that we can suggest you changes

https://ide.codingblocks.com/s/67747
problem is tiling ||
above is screen shots

@Himanshu-Kashyap-635252480157924 i have corrected your code there was two error you was forget to add arr[i-m] and data type are short mod case was also wrong. you can refer this.

1 Like

thanku i got my mistake but only one think why at the time of return you add MOD i didnt get it because at the time of storing in the array we were doing MOD and then storing plesae explain.

@Himanshu-Kashyap-635252480157924 In most of the programming competitions, problems are required to answer the result in 10^9+7 modulo. The reason behind this is to have problems for large integers so that only efficient algorithms can solve them in allowed limited time.The reason of taking Mod is to prevent integer overflows. The largest integer data type in C/C++ is unsigned long long int which is of 64 bit and can handle integer from 0 to (2^64 – 1). But in some problems where the growth rate of output is very high, this high range of unsigned long long may be insufficient