Today we’ll be revisiting an old computer science problem- sorting.
It’s a simple problem that I’ve written about a long time ago. That was when the community was still in its infancy. Now that it has grown, I’d like to visit it again.
Dear reader,
Thank you for supporting Elucidate: for the curious coder. These next few weeks are going to be busy, so expect the length of articles to reduce for a short while.
It’s hard work writing alone. I appreciate all support for my writing. Please consider pledging your financial support- I ask less than 2 cups of coffee a month, and in return you get a new brain-boosting problem solving adventure every week.
Subscribe or pledge your support here
Thanks a lot for your support. Happy reading!
Go ahead and read the article here.
The solution to the challenge problem in the article is here, but try to solve it yourself first.
Meanwhile, here’s another problem on sorting to keep you busy. If you can send me a complete coded solution to the problem, in any language you choose, you stand to win an exclusive free PDF!
There are n swords. Sword k has attack a[k] and defence b[k]. The arrays a and b are given.
A sword, k, is useless if there is another sword whose attack and defence values are both greater than or equal to a[k] and b[k] respectively
How many useless swords are there?