5 kyu

All that is open must be closed...

661 of 1,516ChristianECooper
Description
Loading description...
Stacks
Parsing
Algorithms
Regular Expressions
  • Please sign in or sign up to leave a comment.
  • ejini战神 Avatar

    Description should be language-agnostic

  • artem-totality Avatar

    Well done!) Suggestion to add REGULAR EXPRESSION tag to Kata.

  • ahmet_popaj Avatar

    Very nice and funny kata to solve, well done.

  • Wei-Ting Yang Avatar

    This comment has been hidden.

  • user1430804 Avatar

    amazing kata..

  • HuandXu Avatar

    This comment has been hidden.

  • jeanfrancoishayon Avatar

    i am wondering if

    is_balanced( "(- [(-)])", "()[]--" )

    is True or False for my point of view it's False because two "-" are not nested

  • luisjunco Avatar

    I believe instructions (or sample tests) should be much more explicit with the requirements.

    Some examples:

    isBalanced("(Sensei) says [something]", "()[]") // can a pair be closed before the second one ?
    isBalanced("(Sensei) -says- [something]", "()--[]") // can expect more than two pairs ?
    isBalanced("(Sensei says something)", "()ss") // can the pairs be any charachter? -is it safe to filter letters from the initial string? 
    
  • user6552504 Avatar

    The identical pairs required a bit of a re-think. Nice challenge.

  • raveneer Avatar

    open close same case are brilliant.

  • FArekkusu Avatar

    Python 3 should be enabled.

  • fibonaccios Avatar

    Right, I am going to be honest and say that I have spent more than 5 hours on this one! Is that normal, just for a 5 Kyu?

  • dagolinuxoid Avatar

    This comment has been hidden.

  • mbla Avatar

    Can anyone explain to me: SinglePairNoNestingTests and SinglePairWithNestingTests? I have problem with them.

  • Voile Avatar

    This comment has been hidden.

  • ToineSeiter Avatar

    I'm trying to understand what hides the test SinglePairNoNestingTests :) and I'm facing a question :

    Should this be ok or not ? Kata.IsBalanced(")(", "())(")

  • TheMasquerader Avatar

    Thank you for this Kata, it's been really fun! I had done something similar a while ago, but you added the extra challenge of having identical characters alongside the parentheses.

  • dendisol Avatar

    C#. I think that should be added to the condition of the Kata more examples to check.

  • dendisol Avatar

    С#. May I know the parameters MultiplePairWithNestingTests and SinglePairWithNestingTests tests? Standard tests are performed.

  • Kaiyou Avatar

    Passed this (in C#), but I found a test that will make my solution fail.
    [Test] public void Test_unexpected(){Assert.AreEqual(false, Kata.IsBalanced("[x][x]", "[]xx"));}
    Maybe this test could be added?

  • Avinar Avatar

    Please help. What do tests mean? What arguments do they receive? "Single pair of end caps defined - no nesting" "Multiple pairs of end caps defined - no nesting" "Single pair of end caps defined - with nesting" "Multiple pairs of end caps defined - with nesting" "Multiple open and close caps are same character - with nesting"

    Balanced and unbalanced case. I wrote a function that works perfectly and I can't break my function.

  • Avinar Avatar

    When you create kata please write description's tests smarter.

    I can't understand next: Time: 323ms Passed: 33 Failed: 8 Single pair of end caps defined - no nesting Balanced ✘ Expected: true, instead got: false

    Single pair of end caps defined - with nesting Balanced ✘ Expected: true, instead got: false ✘ Expected: true, instead got: false ✘ Expected: true, instead got: false

    Multiple pairs of end caps defined - with nesting Balanced ✘ Expected: true, instead got: false ✘ Expected: true, instead got: false

    Multiple pairs of end caps defined - no nesting Balanced ✔ Test Passed: Value == true ✘ Expected: true, instead got: false

    Multiple open and close caps are same character - with nesting Balanced ✘ Expected: true, instead got: false

    For people who speak English a little hard translate this description. If I see what function receive and what tests want in output I guess how function must work.

  • user5036852 Avatar

    C#-Translation kumited for this very good kata!

    https://www.codewars.com/kumite/57bab6c56bb034debf0011c9

    Please check and approve it! :-)

  • DGideas Avatar

    Good Kata!

  • kenku102 Avatar

    I'm looking at your example for python and I see that the string (something[else]something) and ()[] is true. But in the next example the string "something 'else' something" and "''" is true. Shouldn't one of those be changed so their both either ([]) "''" or ()[] ""''?

  • drafa Avatar

    I have completed this kata but during submitting got an error. I got honor points but still can't see the solutions. How can I repair it?

  • leviathanbeak Avatar

    Nice one, keep up the good work :)

  • NaMe613 Avatar

    Really nice kata, thanks!

  • adam-tokarski Avatar

    Is it possible that caps would have pair that is not in the first string? I mean, it's not clear that solution should make sure if there is all caps used. For example, what should be returned when is_balanced("(Sensei [says] yes!)", "()[]{}")?

  • MMMAAANNN Avatar

    CoffeeScript added, description mofified.

  • MMMAAANNN Avatar

    JS translation added, description modified.

  • MMMAAANNN Avatar

    Please do not use built-in module name string as a variable name in the pre-set solution.