Skip to content

Instantly share code, notes, and snippets.

View satorusasozaki's full-sized avatar
🍎

Satoru Sasozaki satorusasozaki

🍎
View GitHub Profile

Keybase proof

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:

Keybase proof

I hereby claim:

  • I am satorusasozaki on github.
  • I am satorusasozaki (https://keybase.io/satorusasozaki) on keybase.
  • I have a public key ASCazUqXQFv0jNZlDQFPgITXsNGVy_maEss1thW6kSRZVQo

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
@satorusasozaki
satorusasozaki / Practice_Problem2_Nearest_Larger.cpp
Last active April 29, 2016 07:21
Found some cases that the solution does not return the right answer in app academy practice problem 2-1 and tried to fix it. http://prepwork.appacademy.io/coding-test-2/practice-problems/
// 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]`,