PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 206
Good morning! Here's your coding interview problem for today.

This problem was asked by Twitter.

A permutation can be specified by an array `P`, where `P[i]` represents the location of the element at i in the permutation. For example, `[2, 1, 0]` represents the permutation where elements at the index 0 and 2 are swapped.

Given an array and a permutation, apply the permutation to the array. For example, given the array `["a", "b", "c"]` and the permutation `[2, 1, 0]`, return `["c", "b", "a"]`.

Pull request:
Day206
Resolves #424.

Patch:
diff --git a/README.md b/README.md
index 311e0fb..6635748 100644
--- a/README.md
+++ b/README.md
@@ -215,3 +215,4 @@ problems from
 * [Day 202](https://github.com/vaskoz/dailycodingproblem-go/issues/417)
 * [Day 203](https://github.com/vaskoz/dailycodingproblem-go/issues/419)
 * [Day 204](https://github.com/vaskoz/dailycodingproblem-go/issues/421)
+* [Day 206](https://github.com/vaskoz/dailycodingproblem-go/issues/424)
diff --git a/day206/problem.go b/day206/problem.go
new file mode 100644
index 0000000..7a2b493
--- /dev/null
+++ b/day206/problem.go
@@ -0,0 +1,12 @@
+package day206
+
+// ReorderPermutation reorders the input based on the positions
+// provided in the 'permutationPosition' slice.
+// Runs in O(N) and O(N) space for result.
+func ReorderPermutation(input []interface{}, permutationPosition []int) []interface{} {
+	result := make([]interface{}, len(input))
+	for to, from := range permutationPosition {
+		result[to] = input[from]
+	}
+	return result
+}


Test patch:
diff --git a/day206/problem_test.go b/day206/problem_test.go
new file mode 100644
index 0000000..31d3de5
--- /dev/null
+++ b/day206/problem_test.go
@@ -0,0 +1,31 @@
+package day206
+
+import (
+	"reflect"
+	"testing"
+)
+
+var testcases = []struct {
+	input                []interface{}
+	permutationPositions []int
+	expected             []interface{}
+}{
+	{[]interface{}{"a", "b", "c"}, []int{2, 1, 0}, []interface{}{"c", "b", "a"}},
+}
+
+func TestReorderPermutation(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := ReorderPermutation(tc.input, tc.permutationPositions); !reflect.DeepEqual(tc.expected, result) {
+			t.Errorf("Expected %v, got %v", tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkReorderPermutation(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			ReorderPermutation(tc.input, tc.permutationPositions)
+		}
+	}
+}