Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,17 @@
Function Get-LargestConcatenation ( [int[]]$Integers )
{
# Get the length of the largest integer
$Length = ( $Integers | Sort -Descending | Select -First 1 ).ToString().Length
# Convert to an array of strings,
# sort by each number repeated Length times and truncated to Length,
# and concatenate (join)
$Concat = ( [string[]]$Integers | Sort { ( $_ * $Length ).Substring( 0, $Length ) } -Descending ) -join ''
# Convert to integer (upsizing type if needed)
try { $Integer = [ int32]$Concat }
catch { try { $Integer = [ int64]$Concat }
catch { $Integer = [bigint]$Concat } }
return $Integer
}

View file

@ -0,0 +1,3 @@
Get-LargestConcatenation 1, 34, 3, 98, 9, 76, 45, 4
Get-LargestConcatenation 54, 546, 548, 60
Get-LargestConcatenation 54, 546, 548, 60, 54, 546, 548, 60