+ 1

Return a list of computers with max speed from each brand.

We have struct called computer with attributes: brand name, speed, capacity. The question is to write a function that returns a list of the computers with the maximum speed of each brand. Finding the max speed is easy, but i can't find a way to group the computers from the same brand together. Any help would be appreciated. https://code.sololearn.com/c4qf39Ic1s8a/?ref=app

1st Jan 2022, 4:37 PM
Cindy
4 Antworten
+ 1
If you share your code, it will be much easier to help you, but please, share it as link to the code playground, do not paste it directly here
1st Jan 2022, 5:13 PM
Michal Doruch
+ 1
I added what i did so far Michal Doruch
1st Jan 2022, 5:26 PM
Cindy
+ 1
typedef the stuct, make a separate array using the type, loop through your array of computer objects, test against the max value and add it to the new array if the test passes.
1st Jan 2022, 6:52 PM
rodwynnejones
rodwynnejones - avatar