diff options
| -rw-r--r-- | challenge-307/conor-hoekstra/apl/ch-1.apl | 1 | ||||
| -rw-r--r-- | challenge-307/conor-hoekstra/cuda/ch-1.cu | 5 | ||||
| -rw-r--r-- | challenge-307/conor-hoekstra/python/ch-1.py | 11 |
3 files changed, 17 insertions, 0 deletions
diff --git a/challenge-307/conor-hoekstra/apl/ch-1.apl b/challenge-307/conor-hoekstra/apl/ch-1.apl new file mode 100644 index 0000000000..53a183db51 --- /dev/null +++ b/challenge-307/conor-hoekstra/apl/ch-1.apl @@ -0,0 +1 @@ +CheckOrder ← 1-⍨⍸(⊂⍤⍋⍛⌷)⍛≠
\ No newline at end of file diff --git a/challenge-307/conor-hoekstra/cuda/ch-1.cu b/challenge-307/conor-hoekstra/cuda/ch-1.cu new file mode 100644 index 0000000000..ecab913a08 --- /dev/null +++ b/challenge-307/conor-hoekstra/cuda/ch-1.cu @@ -0,0 +1,5 @@ +#import "parrot.h" + +auto check_order(auto ints) { // + return ints.sort().neq(ints).where() - 1; +}
\ No newline at end of file diff --git a/challenge-307/conor-hoekstra/python/ch-1.py b/challenge-307/conor-hoekstra/python/ch-1.py new file mode 100644 index 0000000000..86d10de038 --- /dev/null +++ b/challenge-307/conor-hoekstra/python/ch-1.py @@ -0,0 +1,11 @@ +import numpy as np + + +def check_order(lst): + return [c for c, (a, b) in enumerate(zip(lst, sorted(lst))) if a != b] + + +# NumPy Solution +def check_order_np(lst): + l = np.array(lst) + return np.where(l != sorted(l))[0] |
