Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![olu adesina](https://uploads.teamtreehouse.com/production/profile-photos/8307162/micro_IMG_4769_9683_.jpg)
olu adesina
23,007 Pointshelp!! jagged arrays
Steven Parker this one is a real toughy
where im i going wrong
namespace Treehouse.CodeChallenges
{
public static class MathHelpers
{
public static int[][] BuildMultiplicationTable(int maxFactor)
{
int[][] arr = new int[maxFactor][];// creating array of arrays.number of rows depend on maxfactor
for (int rowindex = 0; rowindex < arr.Length; rowindex++)
{
arr[rowindex] = new int[maxFactor];//creating colums in each row using maxfactor
for (int colIndex = 0; colIndex < arr[rowindex].Length; colIndex++)
{
arr[rowindex][colIndex] = rowindex * colIndex;//initialising values for each num
}
}
return arr;
}
}
}
1 Answer
![Florian Stegemann](https://uploads.teamtreehouse.com/production/profile-photos/9497362/micro_foto.jpg)
Florian Stegemann
Full Stack JavaScript Techdegree Student 22,660 PointsHey, you're almost there with your code but take another look at the example in the challenge. For a maxFactor of 3 an array with a size of 4 by 4 is returned, because you want all the products from 0 up to and including 3. By just supplying maxFactor as the size for the arrays, you're only getting the products from 0 up to but excluding maxFactor, which means your Arrays are currently always to small by one element.
Steven Parker
230,688 PointsSteven Parker
230,688 PointsJust expand your array sizes by one and you'll pass the challenge.