# Explaination for SEAND2

can anybody tell me that what is:-

(A (mod b[i]))

i don’t understand what mod is it? please explain.

1 Like

a%b means subracting b as many times from a until a becomes less than b.
In other words a%b gives you the remainder when a is divided by b.
Example - 10%3 is equal 1. 10 divided by 3 gives you 1 as the remainder.

2 Likes

Could you please give me some hints to solve this problem? lets share ideas here…

According the problem, our goal is the minimize the sum of the remainders. So can you explain why the answer for the second test case is 754312 which results in remainder of 2. If the answer were 754321, then the remainder would be 1 which is smaller.

this is so because the output provided is not the best solution you can have many solutions for a single test case.

1 Like

@sampritipanda Even i have that doubt.
@bhagatdivesh12 can you upvote the answer?

@abeyaar i had done to do so but it is saying that i don’t have enough reputation to do so.

1 Like

The question says, you are given some number A lets say 123. We have to find the permutation(which can be 213,312, 321,231 or 123 also) of this number which gives minimum mod value with B[i]. The given test case illustrates only one possible permutation. 754312 results in the remainder 2, this is one of the possible solution, not the best one which is 754321. It’s not that the given test case gives you the best answer, but yes, it gives one of the possible answers. Based on the criteria specified, 754312 will fetch you some marks, but the best score will be gained by 754321.

2 Likes