5 kyu

Directions Reduction

2,697 of 89,525g964
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • PraisePeter Avatar

    I think this site is not for a beginner like me that knows nothing about coding

  • jnalzaro17 Avatar

    My code past basic tests but when I submit it, I get this error:

    longer explanation available when compiling with -explain -- [E006] Not Found Error: src/test/scala/fixture.scala:43:38 ------------------ 43 | case (acc, x) if (acc.last != opposites(x)) => acc :+ x | ^^^^^^^^^ | Not found: opposites

    This is not even my code. My code is in src/main this error is stemming from src/test Did I do something wrong?

  • tmxyz Avatar

    I felt like I was moving in circles for a moment.

  • KayleighWasTaken Avatar

    OCaml function name should be snake_case

  • PHK_007 Avatar

    Can someone explain to me why the path ["NORTH", "WEST", "SOUTH", "EAST"] is not reducible even though you end up at the same place? That seems to be the point of this kata

  • mifra00 Avatar

    This comment has been hidden.

  • Adexxy Avatar

    Under sample tests, this test check is invalid: a = ['NORTH', 'NORTH', 'EAST', 'SOUTH', 'EAST', 'EAST', 'SOUTH', 'SOUTH', 'SOUTH', 'NORTH'] test.assert_equals(dir_reduc(a), ['NORTH', 'NORTH', 'EAST', 'SOUTH', 'EAST', 'EAST', 'SOUTH', 'SOUTH'])

    Should return ['EAST', 'EAST', 'EAST', 'SOUTH'] and not ['NORTH', 'NORTH', 'EAST', 'SOUTH', 'EAST', 'EAST', 'SOUTH', 'SOUTH'] as shown in the test.

    Please should confirm!

  • maulikdave Avatar

    This comment has been hidden.

  • maulikdave Avatar

    Following test cases seem invalid;

    1. Under Fixed_Tests - Input {"NORTH","WEST","SOUTH","EAST"} ; Expected says {"NORTH","WEST","SOUTH","EAST"}, but should be {}
    2. Under Random_Tests - Input {"WEST","NORTH","EAST","EAST","EAST","SOUTH","EAST","NORTH","WEST","EAST","SOUTH","SOUTH","SOUTH","EAST","SOUTH","NORTH","WEST"}; Expected says {"WEST", "NORTH", "EAST", "EAST", "EAST", "SOUTH", "EAST", "SOUTH", "SOUTH"}, but should be {EAST", "EAST", "SOUTH", "EAST", "SOUTH"}

    Please check other random test cases as well...

  • dmauas Avatar

    So far all exercises were cool. This one however - just horrible!

    What if get NORTH-NORTH-SOUTH-SOUTH? So this would not be "needless directions"?

    It makes no sense! The worst thing is that it is explained in length, using words and metaphors as if it is intended to make sense - but it does not!

    It takes too long to explain a silly exercise that makes no real logical sense. PASS

  • radicaled42 Avatar

    This comment has been hidden.

  • ahmedelsharkawy99 Avatar

    This comment has been hidden.

  • sheelraj Avatar

    Poorly designed/explained Kata.

  • hbar1st Avatar

    This comment has been hidden.

  • 36115117104 Avatar

    This comment has been deleted.

  • Abdul              Avatar

    it gives ["NORTH", "WEST", "SOUTH", "EAST"] for every test

  • nullfish Avatar

    in fixed_tests

    for directions: {"NORTH", "SOUTH", "SOUTH", "EAST", "WEST", "NORTH", "WEST"}

    expected: {"WEST"}

    but in random_tests

    for directions: {"NORTH", "WEST", "SOUTH", "EAST", "SOUTH", "NORTH", "EAST", "SOUTH", "WEST"}

    expected: {"NORTH", "WEST", "SOUTH", "EAST", "EAST", "SOUTH", "WEST"}

    I'm confused...

  • MissBelle Avatar

    Could someone explain me why ['NORTH', 'NORTH', 'EAST', 'SOUTH', 'EAST', 'EAST', 'SOUTH', 'SOUTH', 'SOUTH', 'NORTH'] should equal ['NORTH', 'NORTH', 'EAST', 'SOUTH', 'EAST', 'EAST', 'SOUTH', 'SOUTH'] and not ['EAST', 'EAST', 'EAST', 'SOUTH']. I am a beginner in english and at coding so please say it as simple you can.

  • Formont Avatar

    Why ["NORTH", "WEST", "SOUTH", "EAST"] should equal ["NORTH", "WEST", "SOUTH", "EAST"], not []?

  • YarShpep Avatar

    Why I can't return ['NORTH', 'EAST'] instead of ['EAST', 'NORTH']????????? And why ['NORTH', 'NORTH', 'EAST', 'SOUTH', 'EAST', 'EAST', 'SOUTH', 'SOUTH'] better than ['SOUTH', 'EAST', 'EAST', 'EAST']????????

  • codeman1337 Avatar

    ["NORTH", "EAST", "NORTH"] expects ["NORTH", "EAST"] why not ["NORTH", "EAST", "NORTH"]?

  • KCGriffith Avatar

    The c++ test case appears to not work. I'm pasting the error I got bellow. I figured I'd post.

    /tmp/main-cc53e9.o: In function dirReduc_Tests::Fixed_Tests()': main.cpp:(.text._ZN14dirReduc_Tests11Fixed_TestsEv[_ZN14dirReduc_Tests11Fixed_TestsEv]+0x21d): undefined reference to DirReduction::dirReduc(std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >&)' main.cpp:(.text._ZN14dirReduc_Tests11Fixed_TestsEv[_ZN14dirReduc_Tests11Fixed_TestsEv]+0x63b): undefined reference to `DirReduction::dirReduc(std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >&)' clang: error: linker command failed with exit code 1 (use -v to see invocation)

  • some_people_6565 Avatar

    instructions unclear, im on mars

  • mic122195 Avatar

    This comment has been hidden.

  • raulvillalobos Avatar

    This comment has been hidden.

  • kamikaze444 Avatar

    This comment has been hidden.

  • kamikaze444 Avatar

    I am confused by the question if it says North East South West My code doesn't have to change anything right?

  • manonBr Avatar

    This comment has been hidden.

  • Ledity Avatar

    This comment has been hidden.

  • senior_kapitoshka Avatar

    I don't know how this problem ended up in 5 kyu, I only know that I spent more time on the reading conditions than on the solution process

  • supersonic_dragonfly_ Avatar

    This comment has been hidden.

  • Ayjemal07 Avatar

    I think this questions is stupid how is this possible?

    a=["NORTH", "WEST", "SOUTH", "EAST"] test.assert_equals(dir_reduc(a), ["NORTH", "WEST", "SOUTH", "EAST"])

    How do you get this result? If you are given these instructions, then taking these directions will lead you to the same spot you were before. I get the question but if the purpose is to avoid redundancy then what is more redundant than being end up in the same spot?

  • miggycoder Avatar

    This kata melted my brain. Why is it so hard I gave up 😭😭😭😭😭😭

  • MKovarovic Avatar

    {"NORTH", "SOUTH", "SOUTH", "EAST", "WEST", "NORTH", "WEST"} According to the instructions, NORTH followed immediately by SOUTH cancels out, and vice versa. Same case for WEST and EAST. Thus the nett result is SOUTH, NORTH, WEST. Then why is the result expected just WEST?

    ...

    ooh.. i get it. it plays by tetris logic.

  • momohdy Avatar

    This comment has been hidden.

  • robinlant Avatar

    This comment has been hidden.

  • Lilku Avatar

    This comment has been hidden.

  • wolkenwand Avatar

    Manage to finish. I must refactor my code to acomodate to new knowledge that you will only get from the testing parameter, why not just incorporate this one example { "NORTH", "WEST", "SOUTH", "EAST" } to the description?

  • johanlindholm Avatar

    Seems some people missed the same thing as I did, the words "right away".

    In this sentence =>

    "Going to one direction and coming back the opposite direction right away is a needless effort."

    This means that its only adjecent directions in the array that should be checked if they are needed or not.

    So:

    W - E - S => S

    W and E cancels out, not needed and adjecent.

    BUT

    W - S - E => W - S - E

    Here S is between W and E, so they do NOT cancel out. W and E are not adjecent and are therefore not "...oposite direction right away..."

  • takish155 Avatar

    I had the answer correct but the order is wrong, I think they should accept these type of stuff (Javascript)

    for ["EAST","EAST","WEST","NORTH","WEST","EAST","EAST","SOUTH","NORTH","WEST"] : expected [ 'NORTH', 'EAST' ] to deeply equal [ 'EAST', 'NORTH' ]

    or ["NORTH","SOUTH","EAST","WEST","SOUTH","NORTH","EAST","SOUTH","WEST","EAST","SOUTH","NORTH","WEST","EAST"] : expected [ 'SOUTH', 'EAST' ] to deeply equal [ 'EAST', 'SOUTH' ]

  • Tiinxhx Avatar

    This comment has been hidden.

  • EnzoPuppet Avatar

    I'm having a problem with the tests, it throws this error: Expected: equal to [ "NORTH", "WEST", "SOUTH", "EAST" ] Actual: [ ]

    But isn't the point of the kata to "cancel" the Nort, South, West, East?

  • Freedom1503 Avatar

    My programm offers shorter way than results

  • Bigoh20 Avatar

    Way too easy for 5kyu

  • saudiGuy Avatar
  • ejini战神 Avatar

    Ruby:

    • 3.0 should be enabled

    • function name should use snake_case

  • ejini战神 Avatar

    C#: method name should be PascalCase (Please refer to implementation of backward compatibility here )

  • rodrigo.ra.rosa Avatar

    Random tests for submission seem to be broken in Python

  • Xsol45 Avatar

    Story about the Wild West which we deserve

  • MihaiS7 Avatar

    Mega weird kata. He focused to write the story about wild west, but forgot to focus on explaination. L

  • kidala Avatar

    Having problems with random tests in TypeScript. For example: Log [ 'SOUTH', 'NORTH', 'NORTH', 'NORTH', 'SOUTH', 'WEST', 'SOUTH', 'EAST', 'EAST' ] [ 'EAST' ] expected [ 'EAST' ] to deeply equal [ 'NORTH', 'WEST', 'SOUTH', …(2) ]

  • CodyMorley Avatar

    There are two bad test conditions. One does let [N, S, E, W] be reduced to []. This is nonsense. Those are directions that lead back home. Specifically the worst case of the problem you're trying to solve.

    Another does not pass because the order is incorrect in the output. This is also a bad test case as all sets of directions are transpoisitonal. Going [N, N , W, W] is the same as going [W, N, W, N] or [W, N, N, W]. You always end up at x: -2, y: 2.

  • rareaqil Avatar

    This comment has been hidden.

  • Vingil Avatar

    One of my results was as follows:

    ['EAST', 'EAST', 'EAST', 'SOUTH'] should equal ['NORTH', 'NORTH', 'EAST', 'SOUTH', 'EAST', 'EAST', 'SOUTH', 'SOUTH']

    However, reasoning about the answer shows that my answer (on the left) is further reduced than the right answer. Both 'North' items are cancelled out by two of the three 'South' items, reducing to my answer. The answer cases don't seem to be fully reduced.

  • Oleg  Ksenchuk Avatar

    Weird. The answers match the final tests, but still throws an error???

  • Al_B Avatar

    "Not all paths can be made simpler. The path ["NORTH", "WEST", "SOUTH", "EAST"] is not reducible. "NORTH" and "WEST", "WEST" and "SOUTH", "SOUTH" and "EAST" are not directly opposite of each other and can't become such. Hence the result path is itself : ["NORTH", "WEST", "SOUTH", "EAST"]."

    This is false because you'd end up back where you started.

  • Ryodakun Avatar

    This kata is weird.
    I used x and y coordinates to determine the destination and then used those to simply return the most optimal route.
    Example: x: -1 y: 1 would be once WEST and once NORTH.
    The input array was:
    ['EAST', 'NORTH', 'SOUTH', 'NORTH', 'WEST', 'NORTH', 'SOUTH', 'NORTH', 'SOUTH', 'WEST']
    The expected answer is: ['EAST', 'NORTH', 'WEST', 'WEST']
    when in reality ['NORTH', 'WEST'] would be the most optimal and time saving route.

    So now I have to wonder how to get a less optimal solution to fit the weird dependencies of this kata...

  • JoeM00 Avatar

    My code keeps timing out when I try to use the .lower() function, does anyone know why this could be?

  • TheHammer Avatar

    This is the worst problem I've encountered on codewars. Not in difficulty, but in logic. The OP wants you to do this in a certain way, even though it defys logic. Poorly written.

  • Dyorbok Avatar

    This comment has been hidden.

  • OwlHoot Avatar

    From the description I understood the task to be removing adjacent opposite pairs in a loop from the list until none remained to remove. But one of the python tests fails with "['SOUTH', 'WEST', 'WEST'] should equal ['WEST']". That seems to make no sense, because SOUTH and WEST are not opposites!

  • eclyphh Avatar

    bro why is one of the tests literally ["NORTHNORTH"] ?????? what is the meaning of this

  • Oyler Avatar

    Ngl this one left a bad taste in my mouth. In the end I was like "fuck it I'll just do what is asked of me" but the kata description is just weird. It says that "NORTH, WEST, SOUTH, EAST" is not reducible. At first I was like "wft that just leads you back to the origin" and I got mad. However then I read a comment that said that maybe it wasn't a 2D plane, maybe there are obstacles and stuff that would not necessarily lead you back to the origin. So I was like "ok that kinda makes sense". I think it could use with a better explanation of why it isn't reducible, maybe add some drawings or sth like that. There is a drawing here in one of the comments on why it may not be reducible that you could just add to the explanation.

  • se35 Avatar

    This comment has been hidden.

  • lolikobob Avatar

    This comment has been hidden.

  • eSarmir Avatar

    This comment has been hidden.

  • Yves848 Avatar

    Should pass Random Tests Expected: {} But was: {}

    Sorry, I can't see any difference. And my code passed all tests in local.

  • q.mak13 Avatar

    This comment has been hidden.

  • amiggo._ Avatar

    This comment has been hidden.

  • faaani Avatar

    This comment has been hidden.

  • yusupess Avatar

    nice kata!

  • MrRicardoAcuna7 Avatar

    I dont really understand the desire output, Is it skipping the opposite cardinals on the new calc or always taking in count it.

  • aw7312793424 Avatar

    Please learn how to use punctuation before posting a challenge. The description is illiterate.

  • dr-vadim Avatar

    "NORTH", "WEST", "SOUTH", "EAST": array lengths differed, expected.length=4 actual.length=0; arrays first differed at element [0]; expected: but was:

    Why I didn't pass this test? It's circular path or not? And I expected that the result will be reduced to zero( stay at one place)

  • AntKazakov99 Avatar

    This comment has been hidden.

  • Woafflation Avatar

    This comment has been hidden.

  • GARCE Avatar

    everybody should activate Harding-Code Skills to solve this kata

  • plamer777 Avatar

    This is the worst task I've ever seen.

  • Juhooray Avatar

    This comment has been hidden.

  • vdgtbsgs Avatar

    This comment has been hidden.

  • Ekremteke Avatar

    This comment has been hidden.

  • Gon-CJ Avatar

    Really nice Kata, made me happy to be able to understad the Aggregate function in C# with it, i will see if i can do the same with JavaScript eventually!

  • SleepyAsura Avatar

    I dont know why, but it was really hard to solve) 2 hours did it

  • Murathancakir Avatar

    I passed the test but it raises an error can you guys please take a look?

  • codeRed-J Avatar

    This comment has been hidden.

  • WalterBlack1 Avatar

    This comment has been hidden.

  • NonBrewed Avatar

    I am not sure if this test case is explained in the desription: ['EAST', 'EAST', 'NORTH', 'WEST'] should equal ['EAST', 'NORTH']

    I will post exact text from the Details

    *Write a function dirReduc which will take an array of strings and returns an array of strings with the needless directions removed (W<->E or S<->N side by side)

    ----Side BY Side is the main ingredient----

    *In ["NORTH", "EAST", "WEST", "SOUTH", "WEST", "WEST"], "NORTH" and "SOUTH" are not directly opposite but they become directly opposite after the reduction of "EAST" and "WEST" so the whole path is reducible to ["WEST", "WEST"].

    ----Again North and South were cancelled, because East and West are Side By Side----

    There are no Side By Side cancellations in ['EAST', 'EAST', 'NORTH', 'WEST']. Please copy and paste the text from the Details that explains this test case

  • NickRTR Avatar

    Hey, my code doesn't pass the tests because, sometimes, my commands aren't ordered as in the solution: instead of ["NORTH", "EAST"] my output is ["EAST", "NORTH"]. That shouldn't make any difference though, right?

  • drippdropp Avatar

    This comment has been hidden.

  • lekaving Avatar

    Could someone explain me why this example is correct?

    arr = [
      'EAST',  'NORTH',
      'NORTH', 'NORTH',
      'EAST',  'NORTH',
      'WEST',  'NORTH',
      'WEST',  'EAST',
      'NORTH'
    ];
    sol = [
      'EAST',  'NORTH',
      'NORTH', 'NORTH',
      'EAST',  'NORTH',
      'WEST',  'NORTH',
      'NORTH'
    ];
    

    This example from result of random Tests. I actually expected

    [
      'NORTH', 'NORTH',
      'NORTH', 'NORTH',
      'NORTH', 'EAST',
      'NORTH'
    ] 
    

    But the last array couldn't pass test but var sol... pass it easy. Probably i just wrong

  • TobiasR Avatar

    Yea these edge cases of empty arrays came a little surprising. Not sure if I missed that in the description but it was a bit annoying. Still, thanks for the task!

  • CrazyFinnGmbH Avatar

    When I "test" my code the fixed tests are passed. But if I "attempt" my code, the fixed tests fail but the random tests pass. Dafuq? Is there some sort of mistake in the tests here, because my code works perfectly fine.

  • YasSer09 Avatar

    Error: ['NORTH', 'EAST'] should equal ['EAST', 'NORTH']

    and when i do a reverse it becomes

    Error: ['EAST', 'NORTH'] should equal ['NORTH', 'EAST']

    WTF

  • laurelis24 Avatar

    I think this is the best kata from g964 that iv done. No math and if i have to compare to other katas easy to understand too.

  • paplic Avatar

    This comment has been hidden.

  • mrkirej Avatar

    I got the following error:

    Failed asserting that Array &0 ( 0 => 'EAST' 1 => 'NORTH' ) is identical to Array &0 ( 0 => 'NORTH' 1 => 'EAST' ).

    When I have the same ouput for both cases?

  • dr_ataraxe Avatar

    This comment has been hidden.

  • tefs Avatar

    I describe a recursive situation in this kata and in others kata: In Kata, when trying to submit the solution, it's executed other tests not mentioned in test class, unabling the developer to finish kata. And the log's provided from this "hiden unit tests" aren't enough. I suggeest to remove this hiddent tests, or mention them in tests class.

  • eljo93 Avatar

    Instructions say: "Not all paths can be made simpler. The path ["NORTH", "WEST", "SOUTH", "EAST"] is not reducible.

    However, when I run my code I get the following result among others:

    ['EAST', 'EAST', 'NORTH', 'WEST'] should equal ['EAST', 'NORTH']

    Like the example case in the instructions, 'EAST' and 'WEST' are separated by a different direction. Thus, the test results are contradicting the instructions for this kata.

  • nrfletcher Avatar

    This comment has been hidden.

  • kantorwg Avatar

    This comment has been hidden.

  • intel-drone Avatar

    I may be stupid... but how those test should pass?

    ['SOUTH', 'WEST'] should equal ['EAST', 'SOUTH']

    ['NORTH', 'NORTH'] should equal ['NORTH', 'NORTH', 'EAST', 'EAST']

    ['WEST', 'WEST'] should equal ['NORTH', 'NORTH']

  • yassinebenarbia Avatar

    This comment has been hidden.

  • SwissBKing Avatar

    This comment has been hidden.

  • KayleighWasTaken Avatar
  • Kaymanod Avatar

    This comment has been hidden.

  • rgleme Avatar

    This comment has been hidden.

  • Luis_Figueiredo Avatar

    Hello everybody. When I try to attempt my code i get a few errors like: ['EAST', 'EAST', 'NORTH', 'WEST'] should equal ['EAST', 'NORTH']. I am new to codewars so unfortunatelly this doesn't give me much information. Can someone tell me how can interpret this errors? Like what should be the array argument which should result in ['EAST', 'NORTH'] so I can understand which mistakes am I making? Thank you in advance

  • gigaSecure Avatar

    This comment has been hidden.

  • fkatende Avatar

    This comment has been hidden.

  • delsix Avatar

    Really cool kata, i loved it!

  • dontknowyou Avatar

    Traceback (most recent call last): File "/workspace/default/tests.py", line 38, in test.assert_equals(dirReduc(a), ['NORTH', 'NORTH']) File "/workspace/default/solution.py", line 5, in dirReduc a.remove(arr[n]) ValueError: list.remove(x): x not in list having this issue showing passed and shows exit code:1

  • HelloWorld!!!!! Avatar

    Function names should be snake_case in Python

  • HeroNorbert Avatar

    This comment has been hidden.

  • nichttoxisch Avatar

    This comment has been hidden.

  • LagAttack Avatar

    This comment has been hidden.

  • LagAttack Avatar

    I wonder if I should use a LinkedList for this

  • Tomo188 Avatar

    i dont understand this kata... it is need to elimnate oposite direction but in second test oposite direction stayed in arry? can someone explain just condition of test?

  • Archfanboy Avatar

    Tested the exact some code in my ide. This was the input (The same as one of the tests)

    input ['SOUTH', 'NORTH', 'WEST'] output ["WEST"]

    This is marked as a failed test. Why?

  • Archfanboy Avatar

    I tested my code in vsc with the exact same fixed tests that it is saying I am failing on but vsc is giving me the expected result. In short, My code works but the tests are saying that it isnt working. (I am using python)

  • Alexenon Avatar

    "NORTH", "WEST", "SOUTH", "EAST": array lengths differed, expected.length=4 actual.length=0

    Why is expected result.length = 4 ? Basically if you stay, you still get there, what's the point ?

  • Greentea_cup Avatar

    C solution attempt results in "Unexpected signal: 6", "double free or corruption (out)". All sample tests passed.

  • Serafion Avatar

    This comment has been hidden.

  • senhorgomes Avatar

    My code passes all the fixed test but keeps on failing random tests...

    ["EAST","WEST","NORTH","SOUTH","NORTH","NORTH","NORTH","WEST","EAST","SOUTH","NORTH"] : expected [ 'NORTH', 'NORTH' ] to deeply equal [ 'NORTH', 'NORTH', 'NORTH' ]

    When you start eliminating opposite directions(which would be the first four and last four elements), you are left with 3 NORTHs, not just 2. It should be NORTH NORTH NORTH, and not NORTH NORTH. Why is it expecting to have one less NORTH?

  • DequinhaB Avatar

    C language: I don't have much experience in C, so I feel the code is badly written and I'm messing with the dynamic memory allocation.

    Tried, and passed the 4 tests. But, when I attempt, I pass 3 tests and then get the error message "Test Crashed Caught unexpected signal: SIGSEGV (11). Invalid memory access."

    Observation: the only dynamic memory that is not freed is the return varible, since they tell that the function result will be freed. All the other dynamic memory allocated are freed in each iteration.

    Can anybody give me a hint on where I'm messing this up? In the mean time, I'll try to do a non-iterative version.

  • Sevos Avatar

    Kata itself is somewhat intheresting, but chosen directions metaphore is very confusing. Because traveling the path doesn't matter to a guy using directions e.g. N-W-E-S is reduces to no directions. But optimizing path to a final destination is not the goal also: making a lap with N-W-S-E is somehow reasonable. Working with something abstract instead of directions would make more sence.

  • Toopkarcher Avatar

    This comment has been hidden.

  • MadMaia Avatar

    Can someone explain the "Not all paths can be made simpler. The path ["NORTH", "WEST", "SOUTH", "EAST"] is not reducible. "? This isn't making any sense to me.

  • davidhogg Avatar

    This comment has been hidden.

  • klaufir Avatar

    After sending an attempt in nim, I get the following result:

    Time: 4598ms Passed: 101 Failed: 0 Exit Code: 1

    StdErr:

    /workspace/solution_tests.nim(46, 15) Warning: Number of spaces around '..<' is not consistent [Spacing]
    /workspace/solution_tests.nim(47, 17) Warning: Deprecated since v0.18.0; use 'rand' instead; random is deprecated [Deprecated]
    /workspace/solution_tests.nim(61, 7) template/generic instantiation of `suite` from here
    /workspace/solution_tests.nim(63, 18) Warning: Deprecated since v0.18.0; use 'rand' instead; random is deprecated [Deprecated]
    Error: execution of an external program failed: '/workspace/tests '
    

    I am not sure how to proceed as all the tests pass & the warning do not come from the submission.

  • eckohub Avatar

    Hi! I could translate to portuguese

  • igiuL Avatar

    This comment has been hidden.

  • attila_ Avatar

    I'm lost 😄

  • devxian Avatar

    This comment has been hidden.

  • akar-0 Avatar
  • klackey Avatar

    This comment has been hidden.

  • Chrono79 Avatar

    JS: Node v14 should be used along with its appropiate assertion tools (Mocha + Chai). Refer to this and this

  • Wetherk Avatar

    This comment has been hidden.

  • pedrogalher Avatar

    I really liked this kata. It took me a while and I had to get out of my comfort zone. I did it in Python.

  • werneo Avatar

    Task that do not allow you to chose an O(n) algorithm because you have to keep directions in order. So you have to go for O(n^2), something that you would definitly avoid IRL!

  • scorpka Avatar

    This comment has been hidden.

  • zotov_l88 Avatar

    I understood that need save the sequence but i don't see it in intstructions. And "… a man was given directions to go from one point to another." but " Hence the result path is itself : ["NORTH", "WEST", "SOUTH", "EAST"]." Why man need walk around if he comes to the same point?

  • Utilizater Avatar

    I had an challenge - to solve it and put negative score to this task. And I did it!!! Terrible description...

  • VukMar Avatar

    Can anyone tell me what this means? i ran the test and it showed green then this appeared:

    UndefinedBehaviorSanitizer:DEADLYSIGNAL ==1==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0xffffffffffffffe8 (pc 0x000000429c3b bp 0x000000000005 sp 0x7ffc4262c180 T1) ==1==The signal is caused by a READ memory access. ==1==WARNING: invalid path to external symbolizer! ==1==WARNING: Failed to use and restart external symbolizer! #0 0x429c3a (/workspace/test+0x429c3a) #1 0x4281a0 (/workspace/test+0x4281a0) #2 0x4268ce (/workspace/test+0x4268ce) #3 0x426423 (/workspace/test+0x426423) #4 0x425ffb (/workspace/test+0x425ffb) #5 0x42be05 (/workspace/test+0x42be05) #6 0x42571d (/workspace/test+0x42571d) #7 0x7fa7c2d06bf6 (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6) #8 0x4045d9 (/workspace/test+0x4045d9)

    UndefinedBehaviorSanitizer can not provide additional info. ==1==ABORTING

  • Kek5chen Avatar

    totally buggy, order shouldnt matter and writing a different algorithm which solves the task is considered wrong.

  • mTheDestroyer Avatar

    This comment has been hidden.

  • AresTotall Avatar

    This comment has been hidden.

  • ddxO Avatar

    This comment has been hidden.

  • user1430804 Avatar

    This comment has been hidden.

  • danieldiazvigil Avatar

    This comment has been hidden.

  • 555Russich Avatar

    This comment has been hidden.

  • ignasiialemany Avatar

    This comment has been hidden.

  • Dudiek12 Avatar

    This comment has been hidden.

  • Benedicto Avatar

    I passed 3 tests but I get this error Traceback (most recent call last): File "tests.py", line 42, in test.assert_equals(dirReduc(a), []) File "/workspace/default/solution.py", line 3, in dirReduc if arr[i]=="SOUTH" and arr[i+1]=="NORTH": IndexError: list index out of range

  • shekelboi Avatar

    This comment has been hidden.

  • rgbellotti Avatar

    This comment has been hidden.

  • ann.piv Avatar

    Please, improve task description. What should be the order of strings in returned array?

  • BK99 Avatar

    This comment has been hidden.

  • smershik88 Avatar

    This comment has been hidden.

  • defr0stt Avatar

    This comment has been hidden.

  • Bean42 Avatar

    Very enjoyable kata.

    I used the same strategy I used in "Valid Braces" the only one solution I could think of.

    Glad I remembered it.

  • evelyn655 Avatar

    Tried to solve it with c++, I have passed the tests but when I click on attempt I get the following error from the compiler: UndefinedBehaviorSanitizer:DEADLYSIGNAL ==1==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x004854524f4e (pc 0x7fbbc92634e1 bp 0x7ffd24eee160 sp 0x7ffd24eedbe8 T1) ==1==The signal is caused by a READ memory access.

    From what I have read it can be because I have used a pointer that is actually Null. But my for-loop looks like: for (auto i = arr.begin(); i != arr.end() - 1; i++)

    I don't think that the pointer will point to somewhere NULL. (?) or what might wrong with my code?

  • sergio_l Avatar

    This comment has been hidden.

  • evilhaxor Avatar

    ez breeze

  • tsp888 Avatar

    Almost destroyed my soul but I solved it..... damn that was painful

  • user1661406 Avatar

    this instruction, is just pointless. North West South East

    is not reducible, because you will end in the same point you started in? What is the point, of walking in a circle, if you want the shortest possible path?

  • cddegarmo Avatar

    Great one. Restrictions of the problem make for a good challenge.

  • Brokoth Avatar

    This comment has been hidden.

  • Brokoth Avatar

    This comment has been hidden.

  • monkey-bidness Avatar

    Can't attach screenshot, but getting a fail with the following:

    input: dirReduc(['NORTH', 'EAST', 'NORTH', 'SOUTH']) output: ['NORTH','EAST']

    ! ['NORTH', 'EAST', 'NORTH', 'SOUTH'] should equal ['NORTH', 'EAST']

  • dwstein Avatar

    This comment has been hidden.

  • monkey-bidness Avatar

    Not sure what the issue is, but the solution input provides all of the solutions but isn't getting picked up for some reason.

  • Niksonman Avatar

    C# tests are wrong: test(7): input=[SOUTH, EAST, SOUTH, SOUTH, EAST, NORTH, EAST, NORTH] Test Failed Expected is <System.String[8]>, actual is <System.String[4]>. But 4 is right! test(10): input=[NORTH, EAST, SOUTH, NORTH, SOUTH, SOUTH, SOUTH, NORTH, EAST, NORTH, NORTH, EAST, SOUTH, EAST, SOUTH] Test Failed Expected is <System.String[11]>, actual is <System.String[5]>. test(8): input=[EAST, NORTH, EAST, SOUTH, NORTH, NORTH, SOUTH, EAST, SOUTH, SOUTH] Expected is <System.String[6]>, actual is <System.String[4]>

  • lalfakzuala Avatar

    Nice Kata if u catch the concept it's pretty easy

  • Zerocondor Avatar

    Nice Kata, but i don't understand why a path like NORTH EAST SOUTH WEST is not reductible the Cowboy will go back to it's initial position. My first solution was to to return an empty array and make the guy stay at his initial position but the solution expect the entire path NORTH EAST SOUTH WEST and the cowbow should travel through direction to comeback to its initial position.

  • Wastelander22 Avatar

    I have only one attempt failed: "random 10 directions: array lengths differed, expected.length=8 actual.length=4"

    WHAT WAS the "random 10 directions"????

  • IvanRia Avatar

    This comment has been hidden.

  • phobicdotno Avatar

    Using python, I get this:

    Test Results: Log ['WEST'] None should equal ['WEST'] Log ['NORTH', 'WEST', 'SOUTH', 'EAST'] Test Passed

    First line, seems correct to me...

  • SageCat Avatar

    This comment has been hidden.

  • CROGOT Avatar

    How to see the input in the test to understand where the error comes from? At the moment I see only an error, but I don’t know what data was received. I only see the input in the first tests.

  • CROGOT Avatar

    Failed asserting that two arrays are equal. Expected: Array ( 0 => 'NORTH' 1 => 'WEST' 2 => 'SOUTH' 3 => 'EAST' ) Actual : Array ( ) выдает ошибку, хотя по массиву видно что он возвращается в ноль и правильный ответ пустой массив

  • paulo_techie Avatar

    Very poor problem statement. Not all reasonable assumptions have been accounted for.

  • Waleed-Alfaris Avatar

    This comment has been hidden.

  • Waleed-Alfaris Avatar

    I'm running into a weird issue. When running the attempt, I get 1 passed, 0 failed. However it exits after one test and gives error 'pop index out of range' on the input ['NORTH', 'NORTH']. The weird thing is when I run the exact same code with the inputs ['NORTH', 'NORTH'] in my IDE, it runs fine without error and gives an output of ['NORTH', 'NORTH'] as it should.

    Why is this happening?

    Not sure if it's ok to post code here. I can post it upon request.

  • Joshuarvlcb Avatar

    This comment has been hidden.

  • Kaî Avatar

    This comment has been hidden.

  • chaplianski Avatar

    Hi. I find answer on my question.

  • max397574 Avatar

    This comment has been hidden.

  • RNOH Avatar

    is 5kyu appropriate or should it be a 6kyu?

  • dfhwze Avatar

    Elixir:

    Solution setup has module definition commented out. There is no good reason for this, is there?

    #defmodule Directions do
    
      def reduce(directions) do
        # your code
      end
    #end
    
  • PsychedelicSquid Avatar

    Errors for my python solution seem to conflict each other, such as:

    ['EAST', 'NORTH', 'WEST'] should equal ['WEST', 'NORTH', 'EAST']

    (here 'EAST' and 'WEST' have not cancelled each other but the list is inverted)

    ['EAST', 'NORTH', 'NORTH', 'WEST'] should equal ['NORTH', 'NORTH']

    (here 'EAST' and 'WEST' DO cancel each other but are on opposite ends of the list)

    I don't see how the desired output is in accordance with the given directions for the kata.

  • Tiagocruz Avatar

    I make a cartesian plane with x and y using a pair, west < x > east and south < y > north. So I make a for across a vector increasing or decreasing the direction . the final result is a value [x,y] , this is a final point. make a regression step by step i have the better way. I passed in the first test , but the other results are confuse.

  • SwenV Avatar

    This comment has been hidden.

  • Alex60 Avatar

    Tried to solve with c++, I have passed the tests but when I click on attempt I get the following error from the compiler: UndefinedBehaviorSanitizer:DEADLYSIGNAL ==1==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x004854524f4e (pc 0x7fbbc92634e1 bp 0x7ffd24eee160 sp 0x7ffd24eedbe8 T1) ==1==The signal is caused by a READ memory access.

    From what I have read it can be because I have used a pointer that is actually Null (not sure because I never used clang) the point is that in Visual Studio the program compiles and works correctly, so I dunno :(

  • borogodrov Avatar

    This comment has been hidden.

  • jyotiska Avatar

    a = ["NORTH", "SOUTH", "SOUTH", "EAST", "WEST", "NORTH", "WEST"] test.assert_equals(dirReduc(a), ['WEST']) My code is giving output as ['WEST'] yet the validation is failing. What is going wrong ? Second test is passed.

  • RICHARDMM110 Avatar

    I passed the first test but then I got errors .Thought the annihilation of the given directions was done identifying the directions from left to right as the example.

  • Ols Avatar

    This comment has been hidden.

  • Round Robin Avatar

    This comment has been hidden.