Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Once again, you erase the instructions in the initial code without reading them, stop doing that. Per-language instructions are supposed to be in there on Codewars, as putting them in the description leads to maintenance issues. This is the preferred way to do this and has been for quite some years now, get used to it.
The API is not strange. You have a buffer of length
n
, write your answer to it and return the actual length of your answer (which will obviously be<= n
as per the problem statement, since you are removing elements in a list of numbers from1
ton
). All of this is explained in the initial code.fixed
duplicate of this issue
Fixed Coffeescript and Ruby too.
Javascript, that seems to be the original language generates arrays without repetitions, so,
I've fixed Python translation to do the same, I think other languages should be checked as well, just to be sure.
So, do you think adding monotonically would make it better? Or changing ascending for non-descending and viceversa? The other way to resolve this, would be making sure there are no repeated numbers in each of those arrays. At least in Python, there is no guarantee that the lists don't have duplicates in random tests.
Why do you say it's not sorted? Because it is, it's not strictly descending, but it is descending.
fixed
Description wasn't updated, but max testing input was.
Problem now is the naive implementation ( sometimes ) passes in time.
Yes UB indeed, I just went with obfuscation mode. (-:
this is the same in the Python version, because this kata is a puzzle
fixed
description now states:
Yeah, I’m a pretty weird dude. I have an entire list of various sayings, quotes, and aphorisms from different people and languages. I'm pretty sure that particular one comes from a Latin book I have called Sententiae by Publilius Syrus. Most of the Latin ones I use are from him. He has a ton of good ones. You should check it out.
Yes, I’ve learned quite a few tricks from Code Golf on Stack Exchange. That said, I don’t post there like I do on Codewars. I just really enjoy trying to find the shortest C solution possible for each kata. It’s not just about code golf though, sometimes it’s about finding something equally as clever, like using shellcode tricks or inline assembly.
It feels like I’m always learning something new from someone’s unique solution. That’s really what I love about Codewars. But you’re totally right, I should visit Code Golf SE more often.
“Aliquid semper addiscendum est.”
Loading more items...