Quick guide on how to setup git signing. Information is aggregated from following sources:
This file contains hidden or 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
| # expression := term operator term | |
| # term := literal | |
| # term := "(" expression ")" | |
| # 0 - bracket open | |
| # 1 - bracket close | |
| # 2 - number | |
| # 3 - operator | |
| tokens = [ |
This file contains hidden or 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
| def to_roman(n): | |
| r = '' | |
| r = 'I' * ((n // 1) % 5) + r | |
| r = 'V' * ((n // 5) % 2) + r | |
| r = 'X' * ((n // 10) % 5) + r | |
| r = 'L' * ((n // 50) % 2) + r | |
| r = 'C' * ((n // 100) % 5) + r | |
| r = 'D' * ((n // 500) % 2) + r | |
| r = 'M' * (n // 1000) + r |
I recently came across a video (https://youtu.be/UogkQ67d0nY?t=703) that looked at a problem and compared the solutions in Scala and Haskell.
The scala solution:
def maximumDifference(nums: Array[Int]): Int =
nums.scanLeft(Int.MaxValue)(_ min _)
.tailOlderNewer