I introduced [Codin Game] the other day, but since there are few simple problems and there is no way to search for problems, like a drill every day. I think [Codin Game] is a little unsuitable for training ... so this time Codewars /) I would like to introduce.
About CodinGame [[CodinGame] A site where you can train from the basics of coding with a browser (You can learn using a pseudo game development environment. Answers can be written by choosing from 25 programming languages!)](Https://qiita. Please see com / javacommons / items / 86efba2d0ce6b2a21fb9) (Because there is a game development style production, first experience [CodinGame] It may be more fun to have it, and if you enjoy it, you may want to read this article as well).
In Codewars, there are 32 types (as of January 10, 2018, BF, C, Clojure CoffeeScript, C ++, Crystal, C #, Dart, Elixir, Erlang, F #, Go, Groovy, Haskell, Java, JavaScript, Kotlin, Lua, Nim, Objective-C, OCaml, PHP, Python, R, Ruby, Rust, Scala, Shell, Solidity, SQL, Swift, TypeScript) programming languages are supported .. However, the difference from CodinGame is that some languages are supported and some are not supported depending on the problem. (Therefore, the threshold for posting questions may be lowered and the number of questions may be large.) ** You can also (repeatedly) challenge a problem once solved using the same language or another language. If you come up with a better algorithm or implementation method, you can try again. ** **
** Codewars allows you to write code, debug, and run tests (provided by the problem creator) on your browser (even if you don't have a development environment on your machine). It can be done with the click of a button, and has the feature that you can submit the answer when you get the approval that it is correct. (So, it's safe with Rakuchin. Also, CodinGame is the same) **
This article gives an example of choosing JavaScript, but you can switch to another language using the "JavaScript" combo box.
Mediocre answer example
function solution(number){
console.log("number=" + number);
let sum = 0;
for (let i=1; i<number; i++) {
console.log(i);
if ((i % 3 === 0) || (i % 5 === 0)) sum += i;
}
return sum;
}
According to @yoskeoka In the "good code" in the screenshot below:
It is said that it will be. (Thank you for your comment @yoskeoka.)
Or https://www.codewars.com/dashboard (from the menu at the top left of the screen You may want to go back to (select .amazonaws.com/0/140610/906cb9b2-d1ae-ce62-3c13-e3d25439acf9.png) to solve the recommended problem.
Recommended Posts