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
| module Solution | |
| type MultiDimList = | |
| | Value of int | |
| | InnerList of MultiDimList list | |
| let addParens (str: string) = | |
| "[" + str + "]" | |
| let rec multiDimListToString (multiDimList: MultiDimList) = |
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
| import java.io.*; | |
| import java.util.*; | |
| import java.util.stream.Collectors; | |
| class Solution { | |
| public static void main(String[] args) { | |
| MultiDimArrayNode n1 = new MultiDimArrayNode(2); | |
| MultiDimArrayNode n2 = new MultiDimArrayNode(3); | |
| MultiDimArrayNode n3 = new MultiDimArrayNode(4); | |
| MultiDimArrayNode n4 = new MultiDimArrayNode(n1, n2, n3); |
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
| defmodule CodePad do | |
| def pair_sum(target_sum, list) do | |
| list | |
| |> get_permutations() | |
| |> Enum.filter(fn [num1, num2] -> | |
| num1 + num2 == target_sum | |
| end) | |
| end | |
| def get_permutations(list) do |
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 GameOfLife = function(width, height) { | |
| this.width = width; | |
| this.height = height; | |
| this.stepInterval = null; // should be used to hold reference to an interval that is "playing" the game | |
| }; | |
| GameOfLife.prototype.createAndShowBoard = function() { | |
| // create <table> element | |
| var goltable = document.createElement("tbody"); | |
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
| Rest/spread operator | |
| Compose Function: https://www.codewars.com/kata/compose-functions-t-combinator/ | |
| Wrapped Function: https://www.codewars.com/kata/511ed4593ba69cba1a000002/ | |
| Duplicate Arguments: http://www.codewars.com/kata/duplicate-arguments | |
| Default+Rest+Spread: https://www.codewars.com/kata/default-plus-rest-plus-spread | |
| Classes | |
| http://www.codewars.com/kata/cylon-evolution //focus on inheritance | |
| https://www.codewars.com/kata/classy-extentions // pretty basic but ES6 specific | |
| https://www.codewars.com/kata/simple-substitution-cipher-helper //also just a basic OOP problem |
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 latinify = function(word) { | |
| var vowels = {a: 1, e: 1, i: 1, o: 1, u: 1} | |
| var letters = word.split(""); | |
| for (var i in letters) { | |
| if (letters[i] === "q" && letters[i + 1] === "u") { | |
| // This is the problem block here | |
| // It does not run when I pass strings like 'quiet' | |
| // For some reason it works if I omit everything after the && operator |