Skip to content

Instantly share code, notes, and snippets.

@counter2015
Created March 11, 2020 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save counter2015/22703eba8039f6495b58197de4a370a9 to your computer and use it in GitHub Desktop.
Save counter2015/22703eba8039f6495b58197de4a370a9 to your computer and use it in GitHub Desktop.
JetBrains quest part 1
scala> val line = "48 61 76 65 20 79 6f 75 20 73 65 65 6e 20 74 68 65 20 73 6f 75 72 63 65 20 63 6f 64 65 20 6f 66 20 74 68 65 20 4a 65 74 42 72 61 69 6e 73 20 77 65 62 73 69 74 65 3f"
line: String = 48 61 76 65 20 79 6f 75 20 73 65 65 6e 20 74 68 65 20 73 6f 75 72 63 65 20 63 6f 64 65 20 6f 66 20 74 68 65 20 4a 65 74 42 72 61 69 6e 73 20 77 65 62 73 69 74 65 3f
scala> line.split(" ").map(Integer.parseInt(_, 16))
res0: Array[Int] = Array(72, 97, 118, 101, 32, 121, 111, 117, 32, 115, 101, 101, 110, 32, 116, 104, 101, 32, 115, 111, 117, 114, 99, 101, 32, 99, 111, 100, 101, 32, 111, 102, 32, 116, 104, 101, 32, 74, 101, 116, 66, 114, 97, 105, 110, 115, 32, 119, 101, 98, 115, 105, 116, 101, 63)
scala> res0.map(_.toChar).mkString
res2: String = Have you seen the source code of the JetBrains website?
scala> val primes: LazyList[Int] = 2 #:: LazyList.from(3,2).filter((n: Int) => primes.takeWhile(p => p*p <= n).forall(n % _ != 0))
primes: LazyList[Int] = LazyList(<not computed>)
scala> primes.takeWhile(_ <= 5000).toList.length - primes.takeWhile(_ < 500).toList.length
res0: Int = 574
scala> val line = "Qlfh$#Li#|rx#duh#uhdglqj#wklv#|rx#pxvw#kdyh#zrunhg#rxw#krz#wr#ghfu|sw#lw1#Wklv#lv#rxu#lvvxh#wudfnhu#ghvljqhg#iru#djloh#whdpv1#Lw#lv#iuhh#iru#xs#wr#6#xvhuv#lq#Forxg#dqg#iru#43#xvhuv#lq#Vwdqgdorqh/#vr#li#|rx#zdqw#wr#jlyh#lw#d#jr#lq#|rxu#whdp#wkhq#zh#wrwdoo|#uhfrpphqg#lw1#|rx#kdyh#ilqlvkhg#wkh#iluvw#Txhvw/#qrz#lw“v#wlph#wr#uhghhp#|rxu#iluvw#sul}h1#Wkh#frgh#iru#wkh#iluvw#txhvw#lv#‟WkhGulyhWrGhyhors†1#Jr#wr#wkh#Txhvw#Sdjh#dqg#xvh#wkh#frgh#wr#fodlp#|rxu#sul}h1#kwwsv=22zzz1mhweudlqv1frp2surpr2txhvw2"
line: String = Qlfh$#Li#|rx#duh#uhdglqj#wklv#|rx#pxvw#kdyh#zrunhg#rxw#krz#wr#ghfu|sw#lw1#Wklv#lv#rxu#lvvxh#wudfnhu#ghvljqhg#iru#djloh#whdpv1#Lw#lv#iuhh#iru#xs#wr#6#xvhuv#lq#Forxg#dqg#iru#43#xvhuv#lq#Vwdqgdorqh/#vr#li#|rx#zdqw#wr#jlyh#lw#d#jr#lq#|rxu#whdp#wkhq#zh#wrwdoo|#uhfrpphqg#lw1#|rx#kdyh#ilqlvkhg#wkh#iluvw#Txhvw/#qrz#lw“v#wlph#wr#uhghhp#|rxu#iluvw#sul}h1#Wkh#frgh#iru#wkh#iluvw#txhvw#lv#‟WkhGulyhWrGhyhors†1#Jr#wr#wkh#Txhvw#Sdjh#dqg#xvh#wkh#frgh#wr#fodlp#|rxu#sul}h1#kwwsv=22zzz1mhweudlqv1frp2surpr2txhvw2
scala> line.map(ch => (ch - ('J' - 'G')).toChar)
res2: String = Nice! If you are reading this you must have worked out how to decrypt it. This is our issue tracker designed for agile teams. It is free for up to 3 users in Cloud and for 10 users in Standalone, so if you want to give it a go in your team then we totally recommend it. you have finished the first Quest, now it’s time to redeem your first prize. The code for the first quest is “TheDriveToDevelop”. Go to the Quest Page and use the code to claim your prize. https://www.jetbrains.com/promo/quest/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment