langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 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