6 kyu

search in multidimensional array

985 of 1,438bakula
Description
Loading description...
Arrays
Algorithms
  • Please sign in or sign up to leave a comment.
  • The_Carpenter Avatar

    This comment has been hidden.

  • amir650 Avatar

    seq = [['"&';""&';"', ']']] value = ']'

    True should equal False

    I don't understand. The sequence contains the ']' character, and I'm correctly identifying it. Why does the test case say this should be false?

  • DOEHOONLEE Avatar

    I am not sure what the problem exactly wants. This is what I console.log() -ed arr => two,six,five,seven,three,nine ..//.. value => three and it returned [Should not find 'three']

    There was also [not find element on 1st level] which I do not get at all. Does this mean I should not be looking for the value on the 1st level?

    Thanks!

  • stanshivam Avatar

    29 tests are passing only 1 test is failing. but this seems to return true. Is this the issue in kata itself? The below test is failing. I am wondering why. As my logic is returing true for the same. locate([[[[0],[[1],[[2],[[3],[[4],[[5],[[6],[[7],[[8],[[9],[[10],[[11],[[12],[[13],[[14],0.5577540242354748]]]]]]]]]]]]]]]]],0.5577540242354748)

  • 3lide Avatar

    This comment has been hidden.

  • filippog Avatar

    I'm struggling a little bit to find a solution that works. I'm using re.findall but I'm always failing some of the random cases because I'm only looking for single quotation marks and ignoring the double marks.

    Is this the right approach or should I look at a different way to flatten the list?

    Thanks and great kata!

  • jessejones21 Avatar

    I've run the same solution a couple times and have gotten different results in terms of how many of the test cases I get right

  • JiPiBi Avatar

    It worked for me by testing lists and tuples ; am I wrong ?

  • sgedye Avatar

    I assume the JavaScript array method 'flat' has been disabled? It doesn't seem to be working for me... I guess that makes sense, otherwise it would be a 'white' problem. But, even so, it would nice to be told so explicitly :)

  • mjsspencer Avatar

    "Not find element on 'x' level". What kind of useless test output messages are these? I can't see the input nor the output for some tests so I have NO idea how to debug. I'm finding so many crappy katas for JavaScript.

  • docgunthrop Avatar

    Random tests can be improved by increasing the character set that it draws from; it should also include numbers and punctuation marks.

  • docgunthrop Avatar

    Python translation is inconsistent with the original JS kata, allowing solutions that wouldn't pass JS tests. Why remove edge case tests that were present in the original?

  • WestwardLand968 Avatar

    Node 10.x should be enabled.

  • WestwardLand968 Avatar

    Some tests are still using expect. (JS)

  • tu6619 Avatar

    This comment has been hidden.

  • No.1SDad Avatar

    I am getting 17 passed and one failed.

    "find element not existing in array:,0.6680575974751264"

    I have no idea how to fix this .

  • computerguy103 Avatar

    Needs tests with comma inside the strings:

    var arr = ['two','six',['five','seven'],'three,nine'];
    Test.assertEquals(locate(arr, 'six'), true, "Should find 'six'");
    Test.assertEquals(locate(arr, 'three'), false, "Should not find 'three'");
    Test.assertEquals(locate(arr, 'three,nine'), true, "Should find 'three,nine'");
    Test.assertEquals(locate(arr, 'five,seven'), false, "Should not find 'five,seven'");
    
  • mikeyferg Avatar

    I am getting 16 passed and one failed.

    "not find element on ~15th level"

    Any ideas on what this means?

  • siddharth Avatar

    This comment has been hidden.

  • ilyinilyas Avatar

    This comment has been hidden.

  • IkiruImi Avatar

    This comment has been hidden.

  • SifoDillas Avatar

    This comment has been hidden.

  • LuigiBakker Avatar

    Any hint about what I am doing wrong when I succesfully test this:

    Test.expect(locate(['a','b',['c','d',['e']]],'e'), "FIRST CASE");
    Test.expect(locate(['a','b',['c','d',['e']]],'a'), "SECOND CASE");
    Test.expect(!locate(['a','b',['c','d',['e']]],'f'), "THIRD CASE");
    Test.expect(locate(['a','b',['c','d',['e',['e',['e',['e',['e',['e',['e',['e',['e',['e',['f',['f',['f',['f',['f',['f',['g',['g',['g',['g',['g',['g',['g',['h']]]]]]]]]]]]]]]]]]]]]]]]]],'h'), "HARD CASE");
    Test.expect(locate([[[[[[[[[[[[[[[['i']]]]]]]]]]]]]]]],'i'), "SECOND HARD CASE");
    

    (I fail the last test)

  • tet5uo Avatar

    I learned alot in this Kata

  • constablebrew Avatar

    This comment has been hidden.

  • charlie.cochran Avatar

    Description says 'Write a function named "find" that...' when I think it should say 'Write a function named "locate" that...' based on the examples and tests.

    Also, under tags there's a typo: 'serach' should be 'search'.

    Enjoyed it! Thanks for making.

  • chiller Avatar

    This comment has been hidden.

  • ssineriz Avatar

    This comment has been hidden.

  • delfuego Avatar

    Nice, simple kata.

    Minor change suggestion: correct the "Examle" typo in the description, and maybe add comment delimiters before the expected return statements in the examples. For example:

    locate(['a','b',['c','d',['e']]], 'e') // should return true