Flowers Challenge on HackerRank
Class name and general comments

Your class is named Flowers but there is a comment here that says:

/* (...) Your class should be named Solution. */


Although I think that Flowers is a much better name, personally.

Generally, I understood your code better than the assignment description, so well done there.

Array instead of ArrayList

Instead of using an ArrayList &lt;Integer&gt;, that by the way would be better to declare as List&lt;Integer&gt; (use interface for declaration, implementation for initialization), you could use an int[] instead, as you know the exact size of the list. There's no need to do any dynamical resizing of the list, so a int[] would be just fine.

Small spacing nitpick

A little nitpick would be to use a bit more spacing, I am a bit allergic to lines like this:

for(int i = 0; i&lt;numFlowers;i++){


better would be:

for (int i = 0; i &lt; numFlowers; i++) {


And also:

total +=(flowersBought+1)*price;


becomes:

total += (flowersBought + 1) * price;


Closing statement

Again, your code was very readable and your approach is good, and indeed it is a greedy algorithm

As said on Hackerrank:


  A greedy algorithm is an algorithm that follows the problem-solving heuristic of making the locally optimal choice at each stage with the hope of finding a global optimum.


This is indeed what your code does. It always picks a way to buy the flower in the cheapest way.