Skip to content

chickenbane/euler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2 when(x) expression

5 find prime factors

8 char.toInt, again in 16

10 prime numbers

11 .run { }, by lazy delegates, IntArray() { } builder, 2d array, wanted to reuse a habit from scala to flatMap(Option) but learned to love filterNotNull

12 find divisors of a number

14 good things to know about comparing IntArray

15 overflowed a long! factorial, P(n,k) C(n,k).

16 number -> string -> List -> List: char.toInt() doesn't do what you want

17 build an arrayList with .apply { }

18 stringTo2dArray(), companion object for 67

19 enum classes, you can't put them in the Euler object and import them

20 sum of digits again, now reusable

21 find divisors, so reuse #12, gotcha using IntArray(n) { lambda } constructor

22 reading a file, char[] alphabet, sliceArray(0..5).size == 6, List<Int?> to List via filterNotNull()

23 "naked" when expression

24 lexicographic permutations

26 substringAfter behavior .run {} vs .apply {} Collections.binarySearch data structures suffix tree trie

27 first-order functions

33 Rational class extension function times operator overloading fold companion object

35 Progression.filter ex: (0..100).filter{ it.isDouble }

36 same as 35, plus Integer.toString(x, 2) to get x in base2

37 rewrote Prime.isPrime

39 object subclass override contains

47 rewrote Prime let private constuctor companion factory

48 substring(IntRange)

67 wanted to read the file by name in classpath, this was the easiest way

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages