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.Generic; | |
using System.IO; | |
using System.Text; | |
using System.Web.Mvc; | |
namespace Demo.Helpers | |
{ | |
public static class TableExtensions | |
{ |
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 unitsElement(x) = | |
match x % 10 with | |
| 0 -> [] | |
| x -> [ string x ] | |
let tensElement(x) = | |
string (x / 10 * 10) | |
let elementsFor2DigitNumber(x) = | |
match x with |
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
var startX = 'C'; | |
var startY = 5; | |
var diagonals = Enumerable.Range(65, 8) | |
.SelectMany(x => Enumerable.Range(1, 8), (x, y) => new { x = (char)x, y }) | |
.Where(coord => | |
((coord.x - startX == coord.y - startY)) | |
|| (startX - coord.x == coord.y - startY) | |
|| (startX - coord.x == coord.y + startY) | |
|| (coord.x - startX == coord.y + startY)) |
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
"1,2,1,1,0,3,1,0,0,2,4,1,0,0,0,0,2,1,0,3,1,0,0,0,6,1,3,0,0,0" | |
.Split(',') | |
.Select(x => x[0] == '0' ? '1' : ' ') | |
.Aggregate("", (x, y) => x += y) | |
.Split(' ') | |
.Max(x => x.Length) |
OlderNewer