allywilson

Shortest Script Challenge - Alphabet staircase

Jan 22nd, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Shortest Script Challenge - Alphabet staircase
  2. #https://www.reddit.com/r/PowerShell/comments/7rwxmp/shortest_script_challenge_alphabet_staircase/
  3.  
  4. #My attempts...
  5. $a="A".."Z";$i=0;Do{-join($a[0..$i]);$i++}while($i-ne26) #56 Initial attempt, typed it out exploded then just removed white space.
  6. $a="A".."Z";$a|%{-join("A"..$_)} #32 A bit more refined.
  7. ("A".."Z")|%{-join("A"..$_)} #28 Who needs $a?
  8. 65..90|%{-join("A"..[char]$_)} #30 Trying a different take, not as good.
  9.  
  10. #/u/vrdse
  11. 0..25|%{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[0..$_]-join''} #51
  12. 0..25|%{('A'..'Z')[0..$_]-join''} #33
  13.  
  14. #/u/nadroj_r
  15. 0..25|%{[char[]](65..90)[0..$_]-join''} #39
  16.  
  17. #/u/bukem
  18. 65..90|%{-join(65..$_|%{[char]$_})} #35
  19. 0..25|%{-join('A'..'Z')[0..$_]} #31
  20. ('A'..'Z')|%{-join('A'..$_)} #28 Yay, same as my 28.
  21.  
  22. #/u/bis
  23. ('A'..'Z')|%{$z+=$_;$z} #23
  24. $z='';('A'..'Z')|%{$z+=$_;$z} #29
  25. $z='';65..90|%{$z+=[char]$_;$z} #31
  26.  
  27. #/u/Jarmom
  28. 65..90|%{$x+=[char]$_;$x} #25 Need to "remove-variable x" to rerun.
Add Comment
Please, Sign In to add comment