Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,17 +0,0 @@
|
|||
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
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue