This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"image" | |
"image/gif" | |
"io/ioutil" | |
"log" | |
"net/http" | |
"sort" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"golang.org/x/net/html" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Design a Rate Printer | |
The printer reads from a file | |
The printer writes to a file | |
Print the Bytes/Second at which the printer is printing every second | |
*/ | |
package main | |
import ( | |
"fmt" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deserialize(input) | |
h = {} | |
l = 0 | |
stack = [] | |
curr_string = "" | |
while l < input.length do | |
case input[l] | |
when "{" #state = DICT_START | |
curr_string = "" | |
when ":" #state = VALUE_START |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"os" | |
"regexp" | |
"strconv" | |
"strings" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gore> a:=[]int{1,2,3} | |
[]int{1, 2, 3} | |
gore> println(a) | |
[3/3]0xc420041f20 | |
gore> b:=[3]int{1,2,3} | |
[3/3]0xc420041ef8 | |
[3]int{1, 2, 3} | |
gore> println(b) | |
# command-line-arguments | |
/var/folders/r0/xqky0mq5773d6bc44pk_xfb00000gp/T/705406632/gore_session.go:10: illegal types for operand: print |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"image" | |
"image/color" | |
"image/gif" | |
"image/jpeg" | |
"image/png" | |
"math/rand" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BreakStr | |
attr_reader :tree | |
def initialize | |
@tree = {} | |
@dict = ["I", "am", "a", "happy", "hap", "sad", "silly", "with"] | |
end | |
def get_valid_prefixes(word) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def max_slice(a) | |
max_start,max_end = 0,0 | |
largest_sum = 0 | |
curr_start,curr_end = 0,0 | |
curr_sum = 0 | |
for i in 0..a.length-1 | |
if (curr_sum + a[i] < 0 ) then | |
curr_start = i+1 | |
curr_sum = 0 | |
elsif (curr_sum + a[i] > curr_sum) then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Fib = { | |
compute: function(n) { | |
return n < 2 ? 1 : Fib.compute(n-1)+Fib.compute(n-2) | |
} | |
} | |
function memoize(obj,prop) { | |
var cache = {} | |
var fn = obj[prop] | |
return function(x) { |