Ad
  • Custom User Avatar

    Nice, it's easy but it take from me a 95 min because i didn't understand the probleme in the first time.

  • Custom User Avatar

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

  • Default User Avatar

    i'm having the same problem now...

  • Default User Avatar

    simplified version of the Diamond exercise, if you've come across that before

  • Default User Avatar

    try this:

    • study the other solutions
    • forget about the kata for a week
    • try to solve it from scratch again
  • Custom User Avatar

    I managed to create the algorithm, however, it was very extensive. I passed the test, but I was not satisfied.

  • Default User Avatar

    But this solution does not account for negative values... 🤔

  • Custom User Avatar

    if its 0, it will just return the number (0) just like if it was negative so theres no need to test for it

  • Custom User Avatar

    You can literally see the spaces in the examples in the description.

  • Custom User Avatar

    The description should have some mention of the spaces around the asterisks for each floor. While it can be inferred that there needs to be spaces to actually make it look like pyramid, if it's not mentioned in the description then it can easily be overlooked. I managed to solve this one, but I was extremely confused by why my code wasn't passing originally when each floor had the correct amount of asterisks. The description describes what a floor looks like with no spaces, implying that each floor should only have asterisks. It's not until after you check the test cases that you can notice it needs spaces. At least not for newer and learning programmers.

  • Custom User Avatar

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

  • Custom User Avatar

    I was looking for a one liner. This I like, but I think we could even optimize further, if we just fill the vector with zeros (up to arr.len()), instead of a second iteration.

  • Custom User Avatar

    OP left the building, closing

  • Custom User Avatar

    Your latest code does not account for leading and trailing space-padding. You are on the right track and using the same technique in your iterative body shall do the trick.

  • Custom User Avatar

    OP solved it, closing

  • Loading more items...