A silly way to reverse an array
Matt Ellen-Tsivintzeli

Matt Ellen-Tsivintzeli @mellen

About: Ultra-fullstack software developer. Python, JavaScript, C#, C.

Location:
Earth
Joined:
May 2, 2017

A silly way to reverse an array

Publish Date: Jan 7 '21
1 1

I was looking at a post in the challenge tag today, and it got me looking into polar coordinates, and I saw that you can rotate an array by 180 degrees by putting a pole in the middle and spinning the array around it, so here it is:

The only issue I have is that small arrays seem to get a load of gaps at the beginning that I needed to filter out. Not sure why that is.

Comments 1 total

  • Matt Ellen-Tsivintzeli
    Matt Ellen-TsivintzeliJan 7, 2021

    I see the problem. I'm creating a square grid, and if the array's length is not a perfect square, then there will be blanks in the grid, which get rotated with the items.

Add comment