7 kyu
Number-Star ladder
2,941 of 5,829m47r1x
Loading description...
ASCII Art
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This comment has been hidden.
Not a kata issue, OP solved it, closing
This comment has been hidden.
There should be a fixed test -->
1
across all languages as some solutions will have trailing lines as output (1\n
)Fixed in CS.
Fixed in Python
CoffeeScript translation
Approved
Scala translation
Approved
python new test framework
Approved
Imo, the author should have allowed pattern(0) and had it like this:
This comment has been hidden.
You must return the result, not print it.
Expected: '1\n12\n1**3', instead got: '1\n12\n1**3\n'
Use markdown formatting:
COBOL translation (author is inactive).
approved
C translation (author gone)
Approved :)
Julia translation
approved
Ruby random tests:
fixed
Ruby translation kumited :) please review and approve ~~
see issue above.
This comment has been hidden.
This comment has been hidden.
the above solution contains this - output = 1 + "*".repeat(i-1) + i; which instead of making a pattern replaces the previous output(patt). Hence, add a newline and change that output statement in else{}.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
You have to return the pattern as a string, not print it.
Exactly! use return folk
The description is a bit ambiguous. Some texts refer to natural numbers as positive integers and others refer to them as non-negative integers. In other words, the ambiguity here lies in whether the use of natural numbers here is zero-inclusive or not. I'm assuming that the use here excludes zero since the tests do not cover this case.
you are right. zero is excluded
description updated
(oops...)
repeat() is a String method yet when attempting to use it an error is thrown. Why?
There should be a test that checks whether the last character is a newline, in order to prevent presentational issues. For example
test.assertEquals("1\n1*2\n", "1\n1*2")
will fail, but it won't show any meaningful result:A simple check that
var ans = pattern(n); ans[ans.length - 1]
isn't\n
would help. Alternatively, add something in the description. (Note: the pending Haskell translation modifies the description slightly to include that hint)there is no newline in the end of the pattern
cool! I'm adding that.
.
This comment has been hidden.
You have a trailing newline. Look at the last character in your string, and at the last character in the expected values in the example tests.
Couldn't figure out what was wrong then read bkaes comment. Trailing newline... Why didn't I check for that.
Yep! there is no newline after the pattern ends.
How do you explain this?
Expected: 1 12 1**3, instead got: 1 12 13 Expected: 1 1*2 13 14 15 16 17, instead got: 1 12 13 14 15 16 1*7 Expected: 1 12 13 14 15 16 1*7 18 19 1******10 111 112 1*******13 114 115 1************16 117 118 1*************19 1*********20, instead got: 1 12 13 1**4 1***5 1**6 1**7 1***8 19 110 111 112 113 114 115 116 117 118 119 1******20
You probably have a trailing newline.
Yep, that worked. Thank you.
This comment has been hidden.
You are required to return the pattern as a string but you are merely printing the pattern. Try joining the elements of final array.
thanks so much. There were a few additional things to tinker with too but that got me going again!
THATS NICE! keep going dude..
Hi all, I am getting the code to post the requested pattern, but only by using console.log. The tests won't pass. I dont want to post code in case its a spoiler but how can i provide to get feedback?
post your code and mark it as a spoiler then someone can reply with some info about where you've gone wrong or what to do next
posted above, but i havent solved so i cant see it... not sure if i'll be able to see replies
This comment has been hidden.
you are entering in a new line after the last condition terminates.
thanks @CrazyMerlyn for the python translation.
It was more complicated than I thought ^_^' Nice Kata :)
What about the random test cases Jiàoshī?