Back to Problem Solutions forum
I have a problem with stars' sorting after calculation of their coordinates after rotation. So, how to sort the stars correctly in this task?
Hi Friend!
Not sure what exactly problem you have. Let me try to rephrase. If the star has Y coordinate less than another, it should appear earlier in the output.
In case if two stars have the same Y coordinate, the one with smaller X should appear earlier.
Hopefully I remember this correctly.
I fail to understand this.
I thought I only needed to sort the Xs and Ys raw. Y as primary key. X as secondary key. Apparently, it's not the case here.
There seem to be a need to process the given Xs and Ys for a new Xs and Ys.
Can you point me to resources to better understand this problem?
Thanks.
You understand the sorting correctly, but before sorting you need to rotate the whole map by the requested number of degrees.
I got it!
My issue was I didn't read the problem well enough.
I missed the part where it mentioned the angle and rotation.
Thank you, Zelevin.
You helpeed me get it right.
Thanks!!