Skip to content

Instantly share code, notes, and snippets.

View burkov's full-sized avatar
:octocat:

Alexander Burkov burkov

:octocat:
  • JetBrains
  • Saint-Petersburg
View GitHub Profile
@burkov
burkov / duke390.md
Last active July 17, 2018 09:05
Duke 390 Changelog

2018

  • Software update
  • New color
  • Larger fan
  • Primary sprocket gets a metal cover instead of plastic.

2017

  • LED headlight
private val openingBrackets = "([{<"
private val closingBrackets = ")]}>"
fun String.isBalancedComplex(): Boolean =
fold(Stack<Char>()) { acc, c ->
when (c) {
// For kotlin beginners: `apply(..)` == `{acc.push(c); acc}`: just a shorthand to eliminate 1 line of code, nothing fancy here
in openingBrackets -> acc.apply { push(c) }
in closingBrackets -> {
if (acc.isEmpty()) return false // leading closing braket like ')))'

Prerequisites

  • Don't use PC while benchmarikng!
  • Laptop power should be pluged-in
  • Maven: 3.3.9
  • Java: 1.8.0_111
  • SBT: 0.13.13
  • Systems under test:
    • [4278U] MacOS Sierra, mbp mid 2014 (MGX72RU/A), core i5-4278U, 8 Gb, 128 Gb SSD
    • [3570K] Ubuntu 16.10, core i5-3570K OC @ 4.3 Ghz, 8 Gb, 240 Gb SSD Kingston SKC300S