We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
change "int count[111]= {0};" to
"long count[111]= {0};"
when k==1 ( test #3)then max count of result is encountered hence count[0] == n*(n+1)/2, which is bound to 10^12.
also count[100] should probably do fine in your code since k <= 100.
note also that when k==1 answer is known right away - n*(n+1), so some more runtime gain ))))
regards
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Consecutive Subsequences
You are viewing a single comment's thread. Return to all comments →
change "int count[111]= {0};" to "long count[111]= {0};" when k==1 ( test #3)then max count of result is encountered hence count[0] == n*(n+1)/2, which is bound to 10^12. also count[100] should probably do fine in your code since k <= 100. note also that when k==1 answer is known right away - n*(n+1), so some more runtime gain ))))
regards