This file contains 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
//https://old.reddit.com/r/dailyprogrammer/comments/o4uyzl/20210621_challenge_395_easy_nonogram_row/ | |
class Nonogram { | |
fun nonogramrow(binaryArray: List<Int>): List<Int> { | |
var currentLength = 0 | |
var building = false | |
val result = mutableListOf<Int>() | |
for (elem in binaryArray) { | |
if (elem == 1) { | |
currentLength++ | |
building = true |
This file contains 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
//https://old.reddit.com/r/dailyprogrammer/comments/nucsik/20210607_challenge_393_easy_making_change/ | |
class MakingChange { | |
fun change(amount: Int): Int { | |
var currentAmount = amount | |
var coinCount = 0 | |
val possibleCoins = listOf(1, 5, 10, 25, 100, 500).sorted().reversed() | |
for (coin in possibleCoins) { | |
while (coin <= currentAmount) { | |
coinCount++ | |
currentAmount -= coin |
This file contains 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
require 'json' | |
require 'net/http' | |
ALERT_PRICE = 419 | |
uri = URI('https://api.bitcoinaverage.com/exchanges/USD') | |
response = Net::HTTP.get(uri) | |
h = JSON.parse(response) | |
price = h['bitfinex']['rates']['last'] |