Constraints in questions

how to apply constraints to variable as said in the questions? Otherwise, when I ran my code CodeChef does not give any points to complete subtask.

The input files of the problems already satisfy all of the given constraints . You don’t need to check for any constraints . They are there for your understanding of the input .

2 Likes

Constraints are given for your understanding, to develop a code suitable for given constraints

For example, code to find factorial upto n <= 10 can be done using int data type,

but for n <= 100, You have to go for large datatype… (BigInteger in java)

Another use of constraints is to analyse time complexity

You can analyse your code’s time complexity using constraints using Big-O notation using following links

  1. https://www.interviewcake.com/article/java/big-o-notation-time-and-space-complexity
  2. http://discrete.gr/complexity/

Please UPVOTE and Accept if you find this helpful…

//