Use lookup table of size 1000x1000


#1

Please mention details of constraints on which the problem will be tested. Else lot of trial and error testing is required to avoid segmentation fault and at the same time to pass all the test cases.


#2

i think it’s ok not to mention constraints cause in interview that won’t be mentioned and some interviewers tell you to improve after you write sudo code. So if you look at it from that perspective it ok.