ruby
def perimeter(n)
num = [0,1]
i = 0
until i == n do
num << num[i] + num [i+1]
i += 1
end
def pyramid(numbers) | |
Array.new(numbers) { |i| [1] * (i + 1) } | |
end |
function pyramid(n) { | |
return Array(n).fill(1).map((elemeent, index) => Array(index + 1).fill(1)); | |
} |
def min_min_max(array) | |
sorted = array.sort | |
sorted_all=[*sorted.first..sorted.last] | |
[sorted.first, (sorted_all-sorted).min, sorted.last] | |
end |
def split_and_add(arr, n) | |
n.times { arr.length.odd? ? arr.unshift(0) : arr | |
arr = arr.each_slice(arr.length/2).to_a.transpose.map { |x| x.sum } | |
} | |
arr | |
end |
ruby
def perimeter(n)
num = [0,1]
i = 0
until i == n do
num << num[i] + num [i+1]
i += 1
end
def validSolution(board)
return false if board.flatten.include?(0)
board.map {|a| a.uniq.count == 9}.include?(false) ? false : board
square_of_3 = board.map { |a| a.each_slice(3).to_a }
s1=square_of_3[0][0].zip(square_of_3[1][0],square_of_3[2][0])
s2=square_of_3[0][1].zip(square_of_3[1][1],square_of_3[2][1])
s3=square_of_3[0][2].zip(square_of_3[1][2],square_of_3[2][2])
s4=square_of_3[3][0].zip(square_of_3[4][0],square_of_3[5][0])
*JS
const solution = (number) => {
return (number < 1 ? 0 : [...Array(number).keys()].filter(num => num % 3 == 0 || num % 5 == 0).reduce((a,b) => a+b));
}
*ruby
Before removing shell, I should have switched to bash using chsh -s /bin/bash
since I can't uninstall zsh as I was using zsh!
chsh -s /bin/bash
chsh -s /usr/local/bin/zsh
to switch back to zshSince I didn't switch to bash first....
initialize git depository in the current directory
git init .
display the git remote/origin
cat .git/config