Step by step explanation of how you can use the greedy algorithm to solve this challenge. I would recommend to go and check the details of this problem and try to solve it yourself in any programing language or just pseudocode.

Photo by Ashkan Forouzani on Unsplash

It states that if you have an array of x length e.g. a [1, 2, 3, 4, 5] and the number of rotations d is 2, you need to write a function to perform a left rotation d on the array a. Imagine this array as a queue of people and you want 2 persons 1, 2 from the…

Aamir Afridi

London based Full stack developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store