# OneWay City puzzle

@Michael1993, mathematically your approach is correct. It probably timed-out or had memory overflow in larger scale.

Print out all numbers you got in your small-scale array, e.g. up to 10x10, or 20x20 as you like. Line up the numbers tidily as a square. Try to spot the pattern with the numbers. The pattern is something taught in school and repeatedly shows up in many puzzles.

I can just tell you that much without spoiling the puzzle.

1 Like

Project Euler

The solution of this problem can be reduced to using only one 1D array of BigInt. Also very important size of the BigInt objects. At first I though that my solution exceeds time limit in Megalopolis test but really problem was in size of my BigInt objects. I just reduce a bit the max number size in my BigInt class and it worked out.

I get the correct answer on the first 4 problems and it doesnât time out on the larger problems I just get a wrong answer but I donât know why.

What do you mean by a BigInt and how do I declare it, also what do you mean by reduce the bit? I can try the 1D array and see what I get.

Instead System.Numerics.BigInteger I used my own class BigInt. And after I reduced max size of the array that represents the big number in my class my solution worked out.
But as it turned out this task can be solved without any arrays ))

This problem is driving me crazyâŚ I tried the 2d array.

I also tried it the math way.
((width + height -2)!) / ((width -1)! * (height - 1)!)

it passes every test but the last two.

Thatâs correct. Maybe you forgot that the answer need only first 1000 digits.

So I am failing the test on the bigger numbers. The last two test still fail. The smaller test pass with no problem. Here is the code that has all the math. Can anyone tell me what I might be doing wrong?
https://pastebin.com/JzeWKtj3