Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
function Get-LookAndSay ($n = 1) {
|
||||
$re = [regex] '(.)\1*'
|
||||
$ret = ""
|
||||
foreach ($m in $re.Matches($n)) {
|
||||
$ret += [string] $m.Length + $m.Value[0]
|
||||
}
|
||||
return $ret
|
||||
}
|
||||
|
||||
function Get-MultipleLookAndSay ($n) {
|
||||
if ($n -eq 0) {
|
||||
return @()
|
||||
} else {
|
||||
$a = 1
|
||||
$a
|
||||
for ($i = 1; $i -lt $n; $i++) {
|
||||
$a = Get-LookAndSay $a
|
||||
$a
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue