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
CREATE TABLE IF NOT EXISTS normalized ( | |
gram string, | |
year int, | |
occurrences bigint | |
); | |
INSERT OVERWRITE TABLE normalized | |
SELECT | |
lower(gram), | |
year, |
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
// You have two numbers represented as linked lists, where each node contains a single digit. | |
// The digits are stored in reverse order, such that the 1’s digit is at the head of the list. | |
// Write a function that adds the two numbers and returns the sum as a linked list. | |
// | |
// EXAMPLE | |
// Input: (3 -> 1 -> 5) + (5 -> 9 -> 2) | |
// Output: 8 -> 0 -> 8 | |
// | |
case class Lint(digits : List[Int]) {require (digits.map(_ / 10).sum == 0)} | |
// Lintegers, integers as lists of digits |
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
/** | |
* Make a lazy value type as a thunk | |
*/ | |
/** | |
* Lazy value wihtout memoization | |
*/ | |
case class LazyVal[A](thunk : () => A) { | |
def value : A = this.thunk() |