Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I think it will also no work for n = 2 .
Because you have not reset the variable value answer = 0 inside for loop of (i).
As a result for n = 2, i condition satisfies , j contition satisfies (Twice), for i = 2 , j = 0 answer = 1 + 3 which is equal to 4.
which is supposed to be equal to 3. please see and check you code once again.