This section contains some of the preparation work before being able to start contributing to the repository.
The first and more important thing to know is that:
# Test if number is prime | |
def isPrime(num) | |
for d in 2..(num - 1) | |
if (num % d) == 0 | |
return false | |
end | |
end | |
true | |
end |
class SuperFoo | |
attr_accessor :data | |
def initialize | |
@data = {} | |
end | |
def self.data_accessor(*args) | |
args.each do |arg| |
def consecutive(arr) | |
#your code here | |
min_numbers = 0 | |
if arr.size > 1 | |
arr.sort! | |
arr.each_with_index do |item, index| | |
if index != (arr.size - 1) | |
min_numbers = min_numbers + ((arr[index+1] - arr[index]) - 1 ) | |
end | |
end |
def f(s) | |
#your code here | |
substring = s.scan(/(.+)\1+/) | |
unless substring.empty? || substring.first.first.size == 1 | |
temp = temp2 = substring | |
loop do | |
break if temp2.empty? | |
temp2 = temp.first.first.scan(/(.+)\1+/) | |
unless temp2.empty? | |
temp = temp2 |
<?php | |
function countDays($dateInString) { | |
// Write your code here | |
// To print results to the standard output you can use print | |
// Example: | |
// print "Hello world!"; | |
$month = ''; |