Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

06 - makeArrayConsecutive2 #47

Closed
Tracked by #40
ValdineiJunior opened this issue Apr 26, 2023 · 0 comments
Closed
Tracked by #40

06 - makeArrayConsecutive2 #47

ValdineiJunior opened this issue Apr 26, 2023 · 0 comments

Comments

@ValdineiJunior
Copy link
Owner

ValdineiJunior commented Apr 26, 2023

06 - makeArrayConsecutive2

Ratiorg got statues of different sizes as a present from CodeMaster for his birthday, each statue having an non-negative integer size. Since he likes to make things perfect, he wants to arrange them from smallest to largest so that each statue will be bigger than the previous one exactly by 1. He may need some additional statues to be able to accomplish that. Help him figure out the minimum number of additional statues needed.

Example

For statues = [6, 2, 3, 8], the output should be
solution(statues) = 3.

Ratiorg needs statues of sizes 4, 5 and 7.

Click here - and see my solution in replit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant