What are constraints and testcases in competitive programming questions?

Hi!

I am an absolute beginner to competitive programming, so I do not know how the problems in contests are formatted. For example, the below problem (Add two Numbers) :

I would like to know what do the ‘Constrains’ / ‘Limits’ / ‘Test Cases’ mean in these kind of questions…

Any help is appreciated! Thanks! :grinning:

Constraints denote the lower and upper bound of the values of variables .
Test cases are number of inputs which your algorithm will be tested against.
eg - the max value in the linked problem of A and B will be 10^5 and min value would be 0.

1 Like

Thanks for the reply @its_abhijeet!

Does this mean lower bound = minimum value of variable & upper bound = maximum value of variable? Like 0 & 10…

Also, in some problems, ‘Limits’ are written instead of constraints. If my above statement is right, then both Constraints & Limits must have the same meaning, right?

@its_abhijeet If you could, please help me :slight_smile: Thanks!

Yes contraints are the limits exactly. And yes LB is the minimum value and UB is the maximum.

1 Like