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.
my fav
It uses join, and also a bad one
when u use listOfNumbers.remove(i); it removes and replace with next indexed number. So u need to check it again but u dont.
When u check it from end to start u needn't to check again cause of all from the end always checked.
Lists work not as arrays and have not fixed length.
Specifying multiple tables in
FROM
clause is the same as making aCROSS JOIN
.Of all the solutions about yours, yours is the first one that doesn't use a join. I didn't use a join either as it was not necessary.
So the for loop starts at the highest index in the List (size-1) and as long as the index is bigger than -1 (until it reaches 0, since that's still a valid index) it will perform the if statement, and remove any even number in the List without skipping anything. The problem with the initial code was that when you reach an even number while incrementing a for loop, it removed that number and caused all the subsequent numbers to shift their index down one place. This caused the bug of skipping over some even numbers. So you could either make sure you decrement i when you remove an even number if you use a normal increasing for loop, or you could start at the end and make your way down, since removing an even number won't affect the index of the previous terms. I hope this helps! :)
See above
I'm also have issue:
An error occurred while loading ./.entry.rb.
Failure/Error: print(tab ? "TAB" : "LOG", data.to_json, mode: "TABLE", label: label)
Encoding::UndefinedConversionError:
"\xE4" from ASCII-8BIT to UTF-8
/runner/frameworks/ruby/common.rb:17:in `encode'
/runner/frameworks/ruby/common.rb:17:in `to_json'
/runner/frameworks/ruby/common.rb:17:in `table'
/runner/frameworks/ruby/sql.rb:84:in `block in run_sql'
/runner/frameworks/ruby/sql.rb:74:in `map'
/runner/frameworks/ruby/sql.rb:74:in `run_sql'
./.spec.rb:1:in `<top (required)>'
./.entry.rb:6:in `<top (required)>'
No examples found.
Kata is currently broken apparently? As of 2017-08-21 a simple "select * from people" query yields this error:
An error occurred while loading ./.entry.rb.
Failure/Error: print(tab ? "TAB" : "LOG", data.to_json, mode: "TABLE", label: label)
Encoding::UndefinedConversionError:
"\xE4" from ASCII-8BIT to UTF-8
/runner/frameworks/ruby/common.rb:17:in `encode'
/runner/frameworks/ruby/common.rb:17:in `to_json'
/runner/frameworks/ruby/common.rb:17:in `table'
/runner/frameworks/ruby/sql.rb:84:in `block in run_sql'
/runner/frameworks/ruby/sql.rb:74:in `map'
/runner/frameworks/ruby/sql.rb:74:in `run_sql'
./.spec.rb:1:in `<top (required)>'
./.entry.rb:6:in `<top (required)>'