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
| (defparameter *letter-hash* (make-hash-table :size 100000)) | |
| (defvar even-length) | |
| (defvar number-of-odds 0) | |
| (defun string-to-list (&key word) | |
| "Will set the even/odd param as well" | |
| (setq even-length (evenp (length word))) | |
| (loop for letter across word collect letter)) | |
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
| ;; Work in progress | |
| (defun all-permutations (list &optional (a (length list))) | |
| "Will give you all the permutations of the list specified" | |
| ;;(format t "The optional param is: ~d~%" a) | |
| (cond ((null list) nil) | |
| ((null (cdr list)) (list list)) | |
| (t (loop for element in list | |
| append (mapcar (lambda (x) (cons element x)) | |
| (all-permutations (remove element list) a)))))) |
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
| (defun factorial! (number) | |
| "returns the factorial of the number given" | |
| (loop for x from 1 upto number | |
| for y = 1 then (* x y) | |
| finally (return y))) |
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
| (read) ;; Throwing this away. Not needed | |
| (defun read-list () | |
| "reading in list of number" | |
| (let ((n (read *standard-input* nil))) | |
| (if (null n) | |
| nil | |
| (cons n (read-list))))) | |
| (defun factorial! (number) |
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
| /* First Non-repeated Character Moderate Challenge on CodeEval */ | |
| /* Comiple this with the -std=c++11 flag to prevent warnings */ | |
| #include <iostream> | |
| #include <fstream> | |
| #include <string> | |
| #include <map> | |
| struct Double | |
| { | |
| int val[2]; // { count, order } |
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
| (defun space-split (string) | |
| "Parses integer strings right now but can be easily altered for | |
| other purposes " | |
| (loop for start = 0 then (1+ finish) | |
| for finish = (position #\Space string :start start) | |
| collecting (parse-integer (subseq string start finish)) | |
| until (null finish))) |
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
| (defun fib (n) | |
| (labels ((calc-fib (n a b) | |
| (if (= n 0) | |
| a | |
| (calc-fib (- n 1) b (+ a b))))) | |
| (calc-fib n 0 1))) | |
| (time (print (fib 7000))) |
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
| <?php | |
| /** Recursive calls should be kept to under 100 per problem prompt. | |
| * Or else this would not work in PHP */ | |
| function iter_palindrome($integer, $count = 0) { | |
| $reverse_int = strrev($integer); | |
| if (intval($reverse_int) == intval($integer)) { | |
| echo $count . " "; |
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
| //Help came from Steven A. Dunn's code | |
| #include <fstream> | |
| #include <iostream> | |
| #include <sstream> | |
| #include <stack> | |
| #include <string> | |
| #include <vector> | |
| using namespace std; |
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 check_match2(person1, person2): | |
| return bin(int('0b'+person1,2) | int('0b'+person2,2)).count('1') | |
| def make_combos2(people): | |
| plist = []; plist.append(input()) | |
| count = 0 | |
| maximum = 0 | |
| for i in range(people-1): | |
| person = input() |