| aakashjohari (33) | |
|
if input : 5 output : 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9 | |
|
|
|
| firedraco (5413) | |||
This probably won't work, so debug it first thanks. | |||
|
Last edited on
|
|||
| Bazzy (6281) | |
| I don't think aakashjohari meant that, but wants a way to display a numeric spiral with any input, that will work just for fixed input. | |
|
|
|
| chu121su12 (31) | |||
Here:
It's not optimized, tough.. Edit: add some comment, reverse variable i and j | |||
|
Last edited on
|
|||
| aakashjohari (33) | |
| thanx | |
|
|
|
| chu121su12 (31) | |||
|
You're welcome. I've tried to remove this line (29 & 30) and it still work:
And it may be better if you use dynamic array. | |||
|
|
|||
| aakashjohari (33) | |
|
thank you chu121su12...... i hope you will help me in future in this way | |
|
|
|
| chu121su12 (31) | |
|
I was just excited about this question. Usually, I got the the triangle stuff and I don't have any idea on any simple-complex advancement. Your question was interesting enough to make me think beside my other codes. This should be my thank. | |
|
|
|
| aakashjohari (33) | |
|
This is an another problem chu121su12, which i have sent in this forum..... suppose input is a triangle as follows- 2 3 4 6 1 9 3 4 8 3 7 2 4 3 1 i am to choose a path from top to botttom so that the sum of the numbers in this path should be maximum. i can move only left or right of the number when coming to the next row. as i am at then i can move only to 3 or 4. if i move to 4 then in next chance i can move to 1 or 9. in this way i will go to bottom. this program only should answer the maximum sum. Thanx!!!!!! | |
|
|
|