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.
fr(int j=1;j<=a;j++) is wrong. You've got the correct start and end conditions of all other loops. Array indexing starts at 0 not 1...although I see now you have a "+1" fudge factor in the cout line - perhaps it's the out of bounds accesses that are breaking it.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Variable Sized Arrays
You are viewing a single comment's thread. Return to all comments →
fr(int j=1;j<=a;j++) is wrong. You've got the correct start and end conditions of all other loops. Array indexing starts at 0 not 1...although I see now you have a "+1" fudge factor in the cout line - perhaps it's the out of bounds accesses that are breaking it.