I hereby claim:
- I am satorusasozaki on github.
- I am satorusasozaki (https://keybase.io/satorusasozaki) on keybase.
- I have a public key ASCos0FSt0gjL1513ensr9X06SflytfPJgzNqA8YIdjFYAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// | |
// main.swift | |
// take_function_return_function | |
// | |
// Created by Satoru Sasozaki on 8/6/16. | |
// Copyright © 2016 Satoru Sasozaki. All rights reserved. | |
// | |
// Write a function which receives a function as its argument and returns a new function which uses the passed function. | |
// makeNewFunction receives a function with type (Int, Int) -> Int and returns a new function which |
// The Original Problem Description | |
// # Write a function, `nearest_larger(arr, i)` which takes an array and an | |
// # index. The function should return another index, `j`: this should | |
// # satisfy: | |
// # | |
// # (a) `arr[i] < arr[j]`, AND | |
// # (b) there is no `j2` closer to `i` than `j` where `arr[i] < arr[j2]`. | |
// # | |
// # In case of ties (see example below), choose the earliest (left-most) | |
// # of the two indices. If no number in `arr` is larger than `arr[i]`, |