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

Issue:
Day 197
Good morning! Here's your coding interview problem for today.

This problem was asked by Amazon.

Given an array and a number k that's smaller than the length of the array, rotate the array to the right k elements in-place.

Pull request:
Day197
Resolves #405.

Patch:
diff --git a/README.md b/README.md
index d78dd61..bc1a636 100644
--- a/README.md
+++ b/README.md
@@ -205,3 +205,4 @@ problems from
 * [Day 192](https://github.com/vaskoz/dailycodingproblem-go/issues/397)
 * [Day 194](https://github.com/vaskoz/dailycodingproblem-go/issues/400)
 * [Day 195](https://github.com/vaskoz/dailycodingproblem-go/issues/401)
+* [Day 197](https://github.com/vaskoz/dailycodingproblem-go/issues/405)
diff --git a/day197/problem.go b/day197/problem.go
new file mode 100644
index 0000000..d2e5bb3
--- /dev/null
+++ b/day197/problem.go
@@ -0,0 +1,16 @@
+package day197
+
+// RotateRightK rotates the nums slice in-place to the right.
+// Runs in O(N) time and O(1) space.
+func RotateRightK(nums []int, k int) {
+	k %= len(nums)
+	for i := 0; i < k/2; i++ {
+		nums[i], nums[k-1-i] = nums[k-1-i], nums[i]
+	}
+	for i := 0; i < (len(nums)-k)/2; i++ {
+		nums[k+i], nums[len(nums)-1-i] = nums[len(nums)-1-i], nums[k+i]
+	}
+	for i := 0; i < len(nums)/2; i++ {
+		nums[i], nums[len(nums)-1-i] = nums[len(nums)-1-i], nums[i]
+	}
+}


Test patch:
diff --git a/day197/problem_test.go b/day197/problem_test.go
new file mode 100644
index 0000000..5dd6576
--- /dev/null
+++ b/day197/problem_test.go
@@ -0,0 +1,34 @@
+package day197
+
+import (
+	"reflect"
+	"testing"
+)
+
+var testcases = []struct {
+	nums     []int
+	k        int
+	expected []int
+}{
+	{[]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 4, []int{5, 6, 7, 8, 9, 10, 1, 2, 3, 4}},
+}
+
+func TestRotateRightK(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		result := append([]int{}, tc.nums...)
+		RotateRightK(result, tc.k)
+		if !reflect.DeepEqual(result, tc.expected) {
+			t.Errorf("Expected %v, got %v", tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkRotateRightK(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			result := append([]int{}, tc.nums...)
+			RotateRightK(result, tc.k)
+		}
+	}
+}