Count My Change

Japt, 5 3 bytes

ñg9

Test it online!

Explanation

I, too, have added a sorting function to my language in the last few weeks :-) ñ takes in an array and a function and sorts the array as if each item had been mapped through that function.

The g function on a string takes in a number n and returns the nth char in the string, wrapping if n is negative or past the end of the string. The strings can thus be aligned as follows:

quarterquarter...
dimedimedimedi...
nickelnickelni...
pennypennypenn...

The 9th char (0-indexed) of each string has been highlighted in bold. These are in the correct order, so all we have to do is ñg9. (Though now that I look back on it, ñg5 would work as well...)


V, 7 bytes

ú/¨qu©¿

Try it online!

This uses the spiffy new sort command I added to V around a week ago (ú). Sweet timing!

The way this works is by sorting every line by default sorting (ASCII values) but ignoring the first match of a certain regex. In this case, the regex is (qu)?, although it has some gross non-ASCII stuff to avoid using backslashes. If you ignore the first two letters of "quarter", it starts with 'a', and then all of the coins are already in alphabetical order.

Non-competing version, 4 bytes

ú!/.

This feature was already implemented, but I hadn't tested it extensively yet so it had a bug that I only realized because of this challenge. There is no TIO link because TIO is slightly behind.

This works by reverse sorting every line but ignoring the first character on each line.


Python, 36 bytes

lambda a:a.sort(key=lambda x:x[-5:])

Unnamed function that sorts the list in-place by the key function given.

The slices of each coin name are then, arter, dime, ickel, and penny - which are in alphabetical (or more importantly, ordinal) order.