We have a function incrementCount.
It takes two arguments, count
and maximumCount.
Increment the count value by 1
and add it to itself.
Keep doing this as many
times as possible, ensuring that
the value of count stays smaller
than maximumCount.
The function should
return the final sum.
-
The count should
increment at least once
irrespective of the
maximumCount value.
-
Do NOT use loops.
Use higher-order functions
like map
, filter
, etc.
-
Order matters: You need
to first increment the value of count,
and
then add it to itself.