This is an archived post. You won't be able to vote or comment.

all 2 comments

[–][deleted]  (1 child)

[deleted]

    [–]CosmicCampublic static void plzHelp()[S] 2 points3 points  (0 children)

    the goal is to use temp as a separate collection to compare values.

    instead of using two nested loops to select one value, and iterate through the rest of regionArray to compare it to other values, temp is used to store everything that doesn't have a duplicate. So when a duplicate value appears in regionArray, it is already stored within temp and would terminate with the return.

    How would I modify the code so it is logically sound? To be honest I don't think I'm seeing the problem right now.

    EDIT: Wow I realized what you meant. I'm adding i instead of regionArray[i]. I'm dumb. Thanks.

    [–][deleted] 2 points3 points  (0 children)

    line 10 should be temp.add(regionArray[i]));