I can't pass the test. Is it still bugged?

/* 20 words beginning with «L»
Create a set of strings (Set<String>), place into it 20 words beginning with «L».
*/

public class Solution
{
    public static HashSet<String> createSet()
    {
        //add your code here
        HashSet<String> set = new HashSet<String>();
        set.add("L1");
        set.add("L2");
        set.add("L3");
        set.add("L4");
        set.add("L5");
        set.add("L6");
        set.add("L7");
        set.add("L8");
        set.add("L9");
        set.add("L0");
        set.add("L11");
        set.add("L12");
        set.add("L13");
        set.add("L14");
        set.add("L15");
        set.add("L16");
        set.add("L17");
        set.add("L18");
        set.add("L19");
        set.add("L20");
        return set;

    }
}

asked 02 Aug '17, 10:45

genek's gravatar image

genek
172
accept rate: 0%


I dont think they update this course at all... It still doesnt work.

link

answered 02 Aug '17, 15:18

YourDoom's gravatar image

YourDoom
1811
accept rate: 35%

edited 02 Aug '17, 15:18

Yeah. It looks like that no one gives a thing about it. I have made so many different attempts. They all work, but none of them pass. Here is the weird one

            Set<String> set = new HashSet<String>(Arrays.asList("Let", "Leed", "Loaf", "Load", "Left", "Lord", "Lemon", "Loot", "Leave", "Leaf", "Love", "Live", "Lend", "Land", "Level", "Lamb", "Lair", "Liar", "Lies", "Lot"));
return (HashSet)set;

and the most reasonable

Set<String> set = new HashSet<String>();
        for(int i = 0; i<20; i++)
            set.add("L" + i);

        return (HashSet)set;

but none of them passes.

link

answered 30 Mar, 03:55

Vagon's gravatar image

Vagon
11
accept rate: 0%

edited 30 Mar, 03:56

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×51
×30
×18

Asked: 02 Aug '17, 10:45

Seen: 726 times

Last updated: 30 Mar, 03:56