Skip to content

Conversation

@hector-ledesma
Copy link

The final commit's comment includes a breakdown of the logic I used for the bonus function.

…gic is as follows:

- Place the passed in array into a mutable copy
- Start with first item of the array
- Start with a separate variable index

-Iterate through array (had to use i and .count, as passing in the value directly was not working out) until we find an item with lower level
	- If we find an agent with lower level, change variable to hold this agent

- After we go through the entire array:
	-Print the agent info we were left with
	-Remove said agent from the array
	-Check if we have any agents left in the array and if we do:
		- Reset the variable that holds the lowest level agent back to first item in the array
		- Reset the value that holds our index back to 0
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

Successfully merging this pull request may close these issues.

1 participant