- 7.2k
- 2
- 13
- 23
PowerShell, (削除) 62 (削除ここまで) (削除) 71 (削除ここまで) 70(削除) 70 (削除ここまで) 66 bytes
+9 bytes when Test cases with an even number of elements added.
-1 byte with splatting.
-4 bytes: wrap the expression with $i,$j to a new scope.
for($a=$args;$a[1]-2)2;$a=&{$n++;$a=($a|?{++$j%2})+($a|?{$i++%2});rv i,j}){$n++}+$n
PowerShell, (削除) 62 (削除ここまで) (削除) 71 (削除ここまで) 70 bytes
+9 bytes when Test cases with an even number of elements added.
-1 byte with splatting.
for($a=$args;$a[1]-2){$n++;$a=($a|?{++$j%2})+($a|?{$i++%2});rv i,j}+$n
PowerShell, (削除) 62 (削除ここまで) (削除) 71 (削除ここまで) (削除) 70 (削除ここまで) 66 bytes
+9 bytes when Test cases with an even number of elements added.
-1 byte with splatting.
-4 bytes: wrap the expression with $i,$j to a new scope.
for($a=$args;$a[1]-2;$a=&{($a|?{++$j%2})+($a|?{$i++%2})}){$n++}+$n
PowerShell, 62(削除) 62 (削除ここまで)(削除) 71 (削除ここまで) 70 bytes
param($a)for(;$a[1]-2;$a=$a[($a|%{$j++*2%$a.Count})]){$n++}+$n
Try it online! +9 bytes when Test cases with an even number of elements added.
Less golfed :)-1 byte with splatting.
paramfor($a$a=$args;$a[1]-2)for{$n++;$a=($r=$a|%$a|?{$j++*2%$a.Count++$j%2};$a[1]-2;$a=$a[$r])+($a|?{$n++$i++%2});rv i,j}+$n
PowerShell, 62 bytes
param($a)for(;$a[1]-2;$a=$a[($a|%{$j++*2%$a.Count})]){$n++}+$n
Less golfed :)
param($a)for($r=$a|%{$j++*2%$a.Count};$a[1]-2;$a=$a[$r]){$n++}+$n
PowerShell, (削除) 62 (削除ここまで)(削除) 71 (削除ここまで) 70 bytes
+9 bytes when Test cases with an even number of elements added.
-1 byte with splatting.
for($a=$args;$a[1]-2){$n++;$a=($a|?{++$j%2})+($a|?{$i++%2});rv i,j}+$n
PowerShell, 62 bytes
param($a)for(;$a[1]-2){$n++;$a=$a[2;$a=$a[($a|%{$j++*2%$a.Count})]){$n++}+$n
Less golfed :)
param($a)for($r=$a|%{$j++*2%$a.Count};$a[1]-2;$a=$a[$r]){$n++}+$n
PowerShell, 62 bytes
param($a)for(;$a[1]-2;$a=$a[($a|%{$j++*2%$a.Count})]){$n++}+$n
Less golfed :)
param($a)for($r=$a|%{$j++*2%$a.Count};$a[1]-2;$a=$a[$r]){$n++}+$n