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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
namespace _6652 | |
{ | |
class Program | |
{ |
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
let coins = [50;22;19;17;10;7;5;3;2;1;1;1;1;1] |> List.sortBy (fun x -> -x) | |
let rec take coins coin = | |
match coins with | |
| x::xs when x > coin -> take xs coin | |
| x::xs when x < coin -> [] | |
| x::xs when x = coin -> xs | |
| [] -> [] | |
let rec change (coins:list<int>) (amt:int) = |
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
using System; | |
using System.Threading.Tasks; | |
namespace SelectMany | |
{ | |
public static class SelectManyExtensions | |
{ | |
public static Func<TResult> SelectMany<T1, T2, TResult>( this Func<T1> f1, Func<T1, Func<T2>> selector, | |
Func<T1, T2, TResult> resultSelector ) | |
{ |