{{ message }}

Instantly share code, notes, and snippets.

🚀
Excelsior!

# Sameer Kolhar kolharsam

🚀
Excelsior!
Last active May 11, 2020
Cassidy's Interview Question - 10/5/20
View goldenRatio.clj
This file contains 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
 ;; Simple to implement I guess the real problem is of double/float precision ;; Will be updating once I learn more about those concepts within Clojure (defn is-in-golden-ratio? "Returns true if the pair of numbers are in the golden ratio" [x y] (let [x-y-ratio (quot x y) greatest (max x y) sum-ratio (quot (+ x y) greatest)] (= x-y-ratio sum-ratio)))
Created May 9, 2020 — forked from smarr/truffle-material.md
Truffle: Languages and Material
View truffle-material.md
Created May 4, 2020
Cassidy's Interview Question - 04/05/2020
View oneRow.clj
This file contains 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 default-input ["candy" "doodle" "pop" "shield" "lag" "typewriter" "this"]) (def qwerty-rows ["qwertyuiop" "asdfghjkl" "zxcvbnm"]) (def dvorak-rows ["pyfgcrl" "aoeuidhtns" "qjkxbmwvz"]) (def azerty-rows ["azertyuiop" "qsdfghjklm" "wxcvbn"]) (defn get-letter-row "Returns the index of the row in which the letter is present"
Created Apr 13, 2020
Cassidy's Interview Question - 13/04
View generateParenthesis.clj
This file contains 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
 (require '[clojure.math.combinatorics :as combo] '[clojure.string :as str]) (defn validParenthesis? "Returns true if a sequence of parentheses are balanced" [coll] (loop [parens_list (apply list coll) stack []] (if (empty? parens_list) (empty? stack)
Last active Apr 7, 2020
Cassidy's Interview Question - 07/04/20
View compareWithBackSpace.clj
This file contains 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
 (defn resultant_string [str_a] (loop [letters (clojure.string/split (apply str (reverse str_a)) #"") letter_stack []] (if (empty? letters) (clojure.string/join letter_stack) (let [current (peek letters)] (if (= current "#") (recur (pop letters) (if (empty? letter_stack) letter_stack (pop letter_stack))) (recur (pop letters) (conj letter_stack current)))))))
Last active Apr 1, 2020
Cassidy's Interview Question - 30/03
View brokenCalculator.clj
This file contains 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
 (defn multiply-two [x] (* x 2)) (defn sub-one [x] (dec x)) (defn broken-calc ([start goal] (broken-calc start goal 0)) ([start goal steps] (if (= start goal) steps
Created Mar 26, 2020
Cassidy's Interview Question - 23/03/20
View compress.js
This file contains 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
 const compress = sortedArr => { let currentLetterIndex = 0, letterCounter = 0, iter = 0; // if we one of each letter let maxIterations = sortedArr.length * 2; while(iter < maxIterations) { if (sortedArr[iter] === sortedArr[currentLetterIndex]) { letterCounter++; iter++;
Created Mar 9, 2020
Cassidy's Interview Question - Mar 09/03/2020
View soln.hs
This file contains 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
 import qualified Data.List as List listSum :: (Num a) => [a] -> a listSum [] = 0 listSum xs = foldr (+) 0 xs getLength :: (Num a) => [a] -> a getLength xs = foldr (\_ acc -> acc + 1) 0 xs myGroup :: (Num a, Eq a, Ord a) => [a] -> [(a, Int)]
Created Feb 17, 2020
A Lisp Parser
View lispParser.js
This file contains 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
 /* Runtime Env: - Node v10.16.0 */ /* Problem Statement - Lisp Parser Write code that takes some Lisp code and returns an abstract syntax tree. The AST should represent the structure of the code and the meaning of each token.
Created Jan 19, 2020
Advent of Code - Day 18 - Both Parts
View GameOfLife.py
This file contains 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
 from os import system start_grid = [line.rstrip('\n') for line in open("input")] def printGrid(grid): print("\n\n\n\n\n\n\n\n\n\n\n") for r in grid: print (''.join(r)) def getLightsOn(grid): counter = 0