# [Jelly], <s>8</s> 7 [bytes] ‘;ṀỤḢṬ+ [Try it online!] or [verify all test cases]. ### How it works (outdated) ;E¡0ỤḢṬ+ Main link. Argument: A E¡ Do e times, where e is 1 if all elements of A are equal and 0 otherwise. ; 0 Append 0 to the array. Ụ Grade up; yield the indices of the resulting array, sorted by their corresponding values in that array. Ḣ Head; extract the first index, which is the index of the first occurrence of the minimum. For an array of equal elements, this will be the index of the appended 0. Ṭ Untruth; for index i, yield an array of i-1 zeroes, followed by a 1. + Add this array to A, incrementing the minimum. [bytes]: https://github.com/DennisMitchell/jelly/wiki/Code-page [Jelly]: https://github.com/DennisMitchell/jelly [Try it online!]: http://jelly.tryitonline.net/#code=4oCYO-G5gOG7pOG4ouG5rCs&input=&args=WzMsIDMsIDMsIDMsIDNd [verify all test cases]: http://jelly.tryitonline.net/#code=4oCYO-G5gOG7pOG4ouG5rCsKxbzDh-KCrEvigqzigqxq4oKs4oCcIC0-IOKAnVk&input=&args=WzFdLCBbMl0sIFsxLCAxXSwgWzMsIDMsIDMsIDMsIDNdLCBbMSwgMl0sIFsyLCAxXSwgWzMsIDEsIDFdLCBbMywgMiwgMV0sIFszLCAyLCAyXSwgWzMsIDMsIDJdLCBbMywgNCwgOSwgM10sIFs0LCA0LCA5LCAzXSwgWzQsIDQsIDksIDRdLCBbNSwgNCwgOSwgNF0