I hereby claim:
- I am xmonkee on github.
- I am mayankmandava (https://keybase.io/mayankmandava) on keybase.
- I have a public key ASBIxeucd4POHWSHSNbdQRDf4QBdtr9uWUFl_DQW0sCsvAo
To claim this, I am signing this object:
(def winnersall (set (clojure.string/split | |
"washington adams jefferson jefferson madison madison monroe | |
monroe adams jackson jackson vanburen harrison polk taylor pierce buchanan | |
lincoln lincoln grant grant hayes garfield cleveland harrison cleveland mckinley | |
mckinley roosevelt taft wilson wilson harding coolidge hoover roosevelt | |
roosevelt roosevelt roosevelt truman eisenhower eisenhower kennedy johnson nixon | |
nixon carter reagan reagan bush clinton clinton bush bush obama obama" #" "))) | |
(def losersall (set (clojure.string/split | |
"clinton jefferson adams pinckney pinckney clinton king adams |
package main | |
import "fmt" | |
func isEven(n int, c chan<- int) { | |
if n%2 == 0{ | |
c <- n | |
} | |
} |
;This week's challenge—not directly related to BFS—is to implement a queue using two stacks. | |
;Queues are a first-in-first-out data structure that we just saw used as a "next to visit" data store in breadth-first search. | |
;Stacks are a last-in-first-out data structure used in depth-first search, and can often be used to implement recursive algorithms iteratively (because the call stack is, itself, a stack). | |
;For this problem, you are to create a queue using two stacks. So your Queue will support the operations: | |
;enqueue(item), which inserts an item into the queue | |
;dequeue(), which removes and returns the oldest item in the queue |
/* | |
* robotMaze.js | |
* | |
* The blue key is inside a labyrinth, and extracting | |
* it will not be easy. | |
* | |
* It's a good thing that you're a AI expert, or | |
* we would have to leave empty-handed. | |
*/ |
;"Find number of disjoint islands in a square matrix of 0's and 1's" | |
(defn rand-mat [size] | |
"Make a random matrix of 1's and 0's" | |
(vec (for [i (range size)] | |
(vec (for [j (range size)] | |
[(-> 2 rand int) [i j]]))))) | |
(defn print-mat [mat] | |
"Print the matrix" |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
try: | |
from xml.etree.cElementTree import XML | |
except ImportError: | |
from xml.etree.ElementTree import XML | |
import zipfile | |
""" | |
Module that extract text from MS XML Word document (.docx). | |
(Inspired by python-docx <https://github.com/mikemaccana/python-docx>) |
;Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: | |
;1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... | |
;By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. | |
;Extra: Give a solution in two different languages. | |
(def fib (cons 0 (cons 1 (lazy-seq (map + fib (rest fib)))))) | |
(def answer (->> fib | |
(take-while #(<= % 4000000)) | |
(filter even?) | |
(reduce +))) |
/* http://www.java2s.com/Code/Java/Development-Class/Converttimebetweentimezone.htm */ | |
import java.util.Calendar; | |
import java.util.GregorianCalendar; | |
import java.util.TimeZone; | |
public class Main { | |
public static void main(String[] args) { | |
Calendar localTime = Calendar.getInstance(); | |
localTime.set(Calendar.HOUR, 17); |
I hereby claim:
To claim this, I am signing this object: