Remove duplicate strings

  • 6
  • Locked
In this task, you need to: 1. Read 6 strings and fill the strings array with them. 2. Remove duplicate strings from the strings array, replacing them with null (null, not the string "null"). Examples: The array after reading the strings: {"Hello", "Hello", "World", "Java", "Tasks", "World"} The arra
You can't complete this task, because you're not signed in.
Comments (3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
UltraGameCoder Java Developer
23 June, 22:55
so apparently this is considered incorrect for the 2nd requirement:
strings[i].equals(strings[j]) //inside the loop of j
And this is corrent:
String currentString = strings[i]; //inside the loop of i (putting it in the loop of j is still incorrent)
currentString.equals(strings[j]) //inside the loop of j
Krzysztof Kasperek
Level 16 , Drammen, Norway
13 May, 15:41
Anyone got an idea why I'm not getting 2nd requirement approved? Output is correct.
Roman
Level 41
16 May, 06:16
Please post your question with the attached solution in the section Help.