Skip to content

Instantly share code, notes, and snippets.

View paweljw's full-sized avatar
🖖

Paweł J. Wal paweljw

🖖
View GitHub Profile
@paweljw
paweljw / KotlinExcercise.kt
Created June 12, 2020 15:36 — forked from mazabin/KotlinExcercise.kt
Task: Sequence C contains elements from A if they are present in B p times, and p is prime number
import kotlin.math.*
fun main() {
val a = arrayListOf(2, 3, 9, 2, 5, 1, 3, 7, 10)
val b = intArrayOf(2, 1, 3, 4, 3, 10, 6, 6, 1, 7, 10, 10, 10)
val c = ArrayList<Int>(a)
for(i in b){
if(isPrimeNumber(countNumber(i, b)))
//if we didn't care about original contents of A, at this point we could remove the values from A and we would get the expected C.
c.remove(i)
@paweljw
paweljw / Procfile
Created February 25, 2018 17:14 — forked from czottmann/Procfile
Example of a Foreman/Capistrano/upstart setup
worker: QUEUE=* bundle exec rake environment resque:work
scheduler: bundle exec rake environment resque:scheduler