Sorted Groups

A challenge by mousetail avatar mousetail

Description

Given a string, divide it into substrings so each substring is sorted (either in ascending or descending order), then output the smallest number of such groups.

Your score in this challenge will be the length of your code in bytes multiplied by the number of sorted groups divided by 3.

For example, if you get the string:

aacdefba

It can be divided into sorted substrings, first one ascending the second descending:

aacdef
ba

Thus you would output 2. If this was a submission, it would be awarded 8 * 2 / 3 = 5 points.

Leaderboard

Author group-bytes
No solutions yet