Home > Enterprise >  What are the constraints in LeetCode Problem?
What are the constraints in LeetCode Problem?

Time:07-28

I am very much new to the time complexity practically although I know this concept very well theoretically, while I was searching practice problems on leetcode I came across about Constraints, I do not know how these constraints work practically in a simple java coding program, let's say I have a two sum problem at leetcode what does these marked constrains mean in the pic below

enter image description here

Your help would really be appreciated pls help and guide how these constraints work and what do these constraints meen in this two sum problem?

Thanks in advance

CodePudding user response:

The constraints essentially give you information about what range of data you are working with, because lets say you have data of a very large range then you have to allocate more memory for it,eg. you have to use long int to store a particular value because its longer than 4 bytes in the internal storage, and thus the constraints give you the edge cases for the range of data you might be working with, but this also form problem to problem.

  • Related