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.
Not declaring variables is bad practice
This comment is hidden because it contains spoiler information about the solution
what is the benefit of using rank() vs row_num() ?
I enjoyed the NULLIF inside COALESCE. Congrats!
best
From PostgreSQL 14 documentation, 7.2.5:
Currently, window functions always require presorted data, and so the query output will be ordered according to one or another of the window functions' PARTITION BY/ORDER BY clauses. It is not recommended to rely on this, however. Use an explicit top-level ORDER BY clause if you want to be sure the results are sorted in a particular way.
https://www.postgresql.org/docs/14/queries-table-expressions.html
Indeed many solutions directly filter out string values and leave everything else in the list, but as @Chrono79 said the Kata input only consists in intgeres and strings.
Furthermore, there exist realistic cases in which one can be interested in retaining only integers or filtering out only specific data types.
The input contains only non-negative integers and strings.
this doesn't filter out the strings but allows only ints. If the source data had booleans or other data types this algo would lose all those other types and only preserve ints, which is not accurate to the request.
No it won't. https://www.citusdata.com/blog/2016/10/12/count-performance/
This comment is hidden because it contains spoiler information about the solution
Yeah I am use to using buffer for strings coming from Java so searched docs for it from the get go, and after seeing the solutions look at the cheap oneliner in code to see what it was doing if anything and nope, just uses the string builder instead of bytes but affectivly the same iterative loop on a count. The only heads up thing was that it preemptively grew the size ahead of time so that if you were looping a large number of times it would not have to resize. https://github.com/golang/go/blob/master/src/strings/strings.go#L533-L536
Does anyone knows how to print the string? to get the log in codewars dart console.
I tried
print('mystring');
and it doesn't work.I first try to achieve an "organic" solution, so I force myself to explorethe documentation, as this varies from language to language.
@ippoippo if you understand a particular technique to be optimal from the onset, and isnt going to complicate your solution, it is not premature to use it. :-)
I have actually been using go professionally since 2013. I use these kata's in their martial arts context, a form to utilize techniques you've learned as reinforcement of that learning.
Loading more items...