I hereby claim:
- I am jonbash on github.
- I am jonbash (https://keybase.io/jonbash) on keybase.
- I have a public key ASBaUMZMSQpwdaoQQoH6cgFgoVJYtq0LI87Tq5keq7uoDAo
To claim this, I am signing this object:
map "g h" NOTHING | |
map "g H" homePage |
--[[ | |
toggle transport playrate between 0.5 and 1.0; | |
sets master transport playback rate to 0.5 | |
if currently at 0.5, sets to 1.0 | |
by Jon Bash (@jonbash, www.jonbash.com) | |
]]-- | |
playrate = reaper.Master_GetPlayRateAtTime(0) |
I hereby claim:
To claim this, I am signing this object:
//: ## version that only accepts positive values | |
//: | |
//: This version follows the instructions of only working for positive values of sum and product | |
func sumAndProduct(sum: Int, product: Int) -> [Int] { | |
for x in 1...sum/2 { | |
let y = sum - x | |
if x * y == product { | |
return [x, y] | |
} |
// INCOMPLETE AS OF 2019-10-09 08:46 | |
func heightChecker(_ heights: [Int]) -> Int { | |
// handle invalid list length | |
if heights.count < 1 || heights.count > 100 { | |
print("List is too long or short; must have between 1 and 100 students (inclusive).") | |
return 0 | |
} | |
var wrongStudents: [(index: Int, height: Int)] = [] |
func fizzBuzz(_ n: Int) -> [String] { | |
if n < 1 { | |
return [] | |
} | |
var output = [String]() | |
for i in 1...n { | |
var stringForI: String = "" | |
if i % 3 == 0 { | |
stringForI += "Fizz" |
func fizzBuzz(_ n: Int) -> [String] { | |
if n < 1 { | |
return [] | |
} | |
var output = [String]() | |
for i in 1...n { | |
var stringForI: String = "" | |
if i % 3 == 0 { | |
stringForI += "Fizz" |
import Foundation | |
/* | |
Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1. | |
Sort the elements of arr1 such that the relative ordering of items in arr1 are the same as in arr2. Elements that don't appear in arr2 should be placed at the end of arr1 in ascending order. | |
Example 1: |
func indicesToSum(from array: [Int], to target: Int) -> [Int] { | |
for i in 1 ..< array.count { | |
for j in 0 ..< i { | |
if array[i] + array[j] == target { return [j,i] } | |
} | |
} | |
print("ERROR: No sum possible!") | |
return [] | |
} |
func findMissingNumbers(_ nums: [Int]) -> [Int] { | |
var includedNums = [Int:Int]() | |
var missingNums = [Int]() | |
for num in nums { | |
includedNums[num] = num | |
} | |
for i in 1...nums.count { | |
if includedNums[i] == nil { |