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 (5)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Level 28 , CodeGym University in India, India
8 February, 21:38
LIke UltraGameCoder pointed out the check is wrong, even when the output is right. Sad!
UltraGameCoder Java Developer
23 June 2022, 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
Egidijus Verseckas
Level 12 , Lithuania
28 March, 18:42
I have exactly the same question, why first solution is not correct?
Krzysztof Kasperek
Level 20 , Drammen, Norway
13 May 2022, 15:41
Anyone got an idea why I'm not getting 2nd requirement approved? Output is correct.
Level 41
16 May 2022, 06:16
Please post your question with the attached solution in the section Help.