|
|
#21 | |
|
FFR Player
Join Date: Dec 2008
Age: 35
Posts: 6,205
|
Quote:
[array]::Reverse($a) write-host $a that's the nice thing about powershell, working with anything other than numbers is generally very very easy
__________________
|
|
|
|
|
|
|
#22 |
|
Wubalubadubdub
Join Date: May 2005
Age: 38
Posts: 1,697
|
lmao never mind then XD Shoulda figured as much since it's a scripting language.
__________________
boop |
|
|
|
|
|
#23 |
|
no
Join Date: Jan 2004
Age: 34
Posts: 1,850
|
string reversal is much more relevant in a language like c/c++ that uses character arrays to store strings since most of what the string reversal problem is is linked list manipulation
EDIT: it depends on how the strings are stored internally too. this is based on the assumption that they are stored as a linked list (no implementation does this, afaik). string reversal is trivial with a dynamic array. Last edited by Fission; 08-12-2013 at 09:21 PM.. |
|
|
|
|
|
#24 | |
|
Confirmed Heartbreaker
Join Date: Jul 2012
Age: 37
Posts: 5,866
|
Quote:
__________________
![]() ![]() ![]() |
|
|
|
|
|
|
#25 |
|
I don't get no respect
Join Date: Jun 2006
Age: 34
Posts: 1,332
|
|
|
|
|
|
|
#26 |
|
FFR Player
Join Date: Dec 2008
Age: 35
Posts: 6,205
|
oh cool
__________________
|
|
|
|
|
|
#27 | |
|
The Supreme Bean
|
Quote:
The prime number problem is a good one. Try using the sieve of eratosthenes.
__________________
Expert AAAs: 22 Master AAAs: 11 Guru AAAs: 9 ![]() ![]() ![]() |
|
|
|
|
|
|
#28 |
|
FFR Veteran
Join Date: Oct 2008
Location: Canada
Posts: 448
|
The Four Fours?
|
|
|
|
|
|
#29 |
|
Kawaii Desu Ne?
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 32
Posts: 4,185
|
Here's another one if you finish the rest are looking for more. I'll put it in spoilers so you can open it when you are ready instead of seeing the problem and being pressured to solve it (if you already have a good queue of problems to solve).
|
|
|
|
|
|
#30 |
|
FFR Player
Join Date: Dec 2008
Age: 35
Posts: 6,205
|
Got sieve implemented, that was fun to write. :P Script is super messy but I'll comment everything and make it look pretty once I get the full thing up and running.
Code:
$n = read-host "input integer"
$A = $False,$False
$x = 2
$B = @()
do{
$A += $True
$x++
}
until($x -eq [int]$n+1)
$i = 2
do{
write-host "Current value of i is $i."
if($A[$i] -eq $True){
$x = 0
do{
$j = ($i*$i)+($i*$x)
write-host "Current value of j is $j."
if($j -gt $n){
}
else{
$A[$j] = $False
}
$x++
write-host "Current value of x is $x."
}
while($j -lt $n)
}
$i++
}
while($i -lt [system.math]::Sqrt($n))
$x = 0
do{
if($a[$x] -eq $true){
[array]$B += $x
}
$x++
}
until($x -eq $n)
$B
__________________
|
|
|
|
|
|
#31 | |
|
FFR Player
Join Date: Dec 2008
Age: 35
Posts: 6,205
|
Quote:
You're a dick :C
__________________
|
|
|
|
|
|
|
#32 |
|
Kawaii Desu Ne?
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 32
Posts: 4,185
|
Yup
|
|
|
|
|
|
#33 |
|
B^)
|
Part of my "job" has me switching the status of these TMS trips from uncompleted to done.. I do this several thousands of times every few days and it's so annoying. Is there any way you could write something up that will do this for me? I'll give you more info when I get to a computer if you're willing.
__________________
|
|
|
|
|
|
#34 |
|
FFR Player
Join Date: Dec 2008
Age: 35
Posts: 6,205
|
TMS trips?
__________________
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|