Ad
  • Custom User Avatar

    But now the values are able to include 0.

  • Custom User Avatar

    fixed

  • Custom User Avatar

    The description ends with: "Note: Assume that all values in the list are positive integer values > 0 and each value in the list is unique."

    The C random tests give repeat values, and it caused my first solution, made with that assumption, to time out.

  • Custom User Avatar

    Please frame the question properly.
    It makes us think that we have can't have a char in string more than twice!

  • Custom User Avatar
  • Custom User Avatar

    I think that the "repeated once" is a language trap. I can see how it can be ambiguous, especially for non-native speakers.

  • Custom User Avatar

    Why would you think that? The current test code is correct.

    Edit: I see why you think that. Looking at your code, you've managed to do the task exactly backwards. You are supposed to take the input string and double each letter. You've written code which takes an input string and removes all double letters.

  • Custom User Avatar

    Incorrect Python test code
    The correct code should be

    @test.describe("Fixed Tests")
    def fixed_tests():
    @test.it('Basic Test Cases')
    def basic_test_cases():
    test.assert_equals(double_char("SSttrriinngg"),"String")
    test.assert_equals(double_char("HHeelllloo WWoorrlldd"),"Helo World")
    test.assert_equals(double_char("11223344!!__ "),"1234!_ ")

  • Custom User Avatar

    Click reset and try again, there is no problem with the tests unless you somehow edited them.

    But the problem here is you renamed the method to doubleChars instead of doubleChar and that's why the tests don't find it and throw that error.

  • Custom User Avatar

    Issues in test code:

    src/test/java/SolutionTest.java:8: error: cannot find symbol
    assertEquals("SSttrriinngg",Solution.doubleChar("String"));
    ^
    symbol: method doubleChar(String)
    location: class Solution
    src/test/java/SolutionTest.java:9: error: cannot find symbol
    assertEquals("HHeelllloo WWoorrlldd",Solution.doubleChar("Hello World"));
    ^
    symbol: method doubleChar(String)
    location: class Solution
    src/test/java/SolutionTest.java:10: error: cannot find symbol
    assertEquals("11223344!!__ ",Solution.doubleChar("1234!_ "));
    ^
    symbol: method doubleChar(String)
    location: class Solution
    3 errors

  • Custom User Avatar

    i is never incremented in your code , so you write to doubled forever

  • Custom User Avatar

    my code is all correct but i keep getting segsevs(11):invaild memory access error what to do ?

  • Custom User Avatar
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Loading more items...