I hereby claim:
- I am dustmason on github.
- I am dustmason (https://keybase.io/dustmason) on keybase.
- I have a public key ASCHhKGcG3EAzzZ3-nz6OEC2IxecrY77ntKiusv920L8lwo
To claim this, I am signing this object:
def optimal_move state | |
return state if Math.sqrt(state) % 1 == 0 # its a perfect square | |
(1..Math.sqrt(state)).each { |n| return n*n if optimal_move(state - (n*n)) == -1 } | |
return -1 | |
end |
require 'io/console' | |
class TicTacToe | |
attr_reader :state | |
def initialize *players | |
@players = players | |
@state = players.map { Array.new(9) } | |
@marks = ['X','O'] |
I hereby claim:
To claim this, I am signing this object:
def find_median_sorted arr1, arr2 | |
joined = (arr1 + arr2).sort | |
if joined.size % 2 == 0 | |
return joined[(joined.size/2)-1..(joined.size/2)].reduce(&:+) / 2.0 | |
else | |
return joined[joined.size/2] | |
end | |
end |
<table> | |
<tr> | |
<th> | |
Column 1 | |
</th> | |
<th> | |
Column 2 | |
</th> | |
<th> |
class Solution | |
# @param a : array of integers | |
# @return an integer | |
def solve(a) | |
found = -1 | |
sorted = a.select { |n| n >= 0 }.sort | |
s = sorted.size | |
sorted.each_with_index do |n, i| | |
if n >= 0 && n == s - 1 - i && sorted[i+1] != n |
#!/bin/bash | |
# Author : Hemanth.HM | |
# Email : hemanth[dot]hm[at]gmail[dot]com | |
# License : GNU GPLv3 | |
# | |
function useage() | |
{ | |
cat << EOU | |
Useage: bash $0 <path to the binary> <path to copy the dependencies> |
var OP1MidiInterface = function(midi) { | |
var data, cmd, channel, type, note, velocity; | |
midi.inputs.forEach(function(input) { | |
if (input.name.indexOf('OP-1') > -1) { | |
document.dispatchEvent(new Event('midi-connected')); | |
input.onmidimessage = onMIDIMessage; | |
} | |
}); | |
midi.onstatechange = onStateChange; |
(function(document, window) { | |
var fullWidth = 1111.0; | |
var img = document.querySelector("#op1-keys:not([data-ready])"); | |
if (img) { | |
var keys = [ | |
[[210, 58], [270, 173]], // F | |
[[211, 0], [298, 57]], // F# | |
[[269, 58], [327, 174]], |