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

Issue:
Day 204
Good morning! Here's your coding interview problem for today.

This problem was asked by Amazon.

Given a complete binary tree, count the number of nodes in faster than O(n) time. Recall that a complete binary tree has every level filled except the last, and the nodes in the last level are filled starting from the left.

Pull request:
Day204
Resolves #421.

Patch:
diff --git a/README.md b/README.md
index 503807c..311e0fb 100644
--- a/README.md
+++ b/README.md
@@ -214,3 +214,4 @@ problems from
 * [Day 201](https://github.com/vaskoz/dailycodingproblem-go/issues/415)
 * [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)
diff --git a/day204/problem.go b/day204/problem.go
new file mode 100644
index 0000000..c5c46f4
--- /dev/null
+++ b/day204/problem.go
@@ -0,0 +1,27 @@
+package day204
+
+// CompleteBinaryTree is a complete binary tree.
+type CompleteBinaryTree struct {
+	Value       interface{}
+	Left, Right *CompleteBinaryTree
+}
+
+// CountCompleteBinaryTree returns the number of nodes in a complete
+// binary tree is less than O(N) time.
+// Runs in O(height^2) time.
+func CountCompleteBinaryTree(tree *CompleteBinaryTree) int {
+	if tree == nil {
+		return 0
+	}
+	var leftHeight, rightHeight int
+	for left := tree; left != nil; left = left.Left {
+		leftHeight++
+	}
+	for right := tree; right != nil; right = right.Right {
+		rightHeight++
+	}
+	if leftHeight == rightHeight {
+		return (1 << uint(leftHeight)) - 1
+	}
+	return CountCompleteBinaryTree(tree.Left) + CountCompleteBinaryTree(tree.Right) + 1
+}


Test patch:
diff --git a/day204/problem_test.go b/day204/problem_test.go
new file mode 100644
index 0000000..8cbf56d
--- /dev/null
+++ b/day204/problem_test.go
@@ -0,0 +1,50 @@
+package day204
+
+import "testing"
+
+var testcases = []struct {
+	tree  *CompleteBinaryTree
+	count int
+}{
+	{&CompleteBinaryTree{
+		"a",
+		&CompleteBinaryTree{
+			"b",
+			&CompleteBinaryTree{
+				"d",
+				&CompleteBinaryTree{"h", nil, nil},
+				&CompleteBinaryTree{"i", nil, nil},
+			},
+			&CompleteBinaryTree{
+				"e",
+				&CompleteBinaryTree{"j", nil, nil},
+				&CompleteBinaryTree{"k", nil, nil},
+			}},
+		&CompleteBinaryTree{
+			"c",
+			&CompleteBinaryTree{
+				"f",
+				&CompleteBinaryTree{"l", nil, nil},
+				nil,
+			},
+			&CompleteBinaryTree{"g", nil, nil},
+		},
+	}, 12},
+}
+
+func TestCountCompleteBinaryTree(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if count := CountCompleteBinaryTree(tc.tree); count != tc.count {
+			t.Errorf("Expected %v, got %v", tc.count, count)
+		}
+	}
+}
+
+func BenchmarkCountCompleteBinaryTree(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			CountCompleteBinaryTree(tc.tree)
+		}
+	}
+}
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 106
Good morning! Here's your coding interview problem for today.

This problem was asked by Pinterest.

Given an integer list where each number represents the number of hops you can make, determine whether you can reach to the last index starting at index 0.

For example, `[2, 0, 1, 0]` returns `true` while `[1, 1, 0, 1]` returns `false`.

Pull request:
Day106
Resolves #223.

Patch:
diff --git a/README.md b/README.md
index e1ff522..24deacd 100644
--- a/README.md
+++ b/README.md
@@ -115,3 +115,4 @@ problems from
 * [Day 103](https://github.com/vaskoz/dailycodingproblem-go/issues/217)
 * [Day 104](https://github.com/vaskoz/dailycodingproblem-go/issues/219)
 * [Day 105](https://github.com/vaskoz/dailycodingproblem-go/issues/221)
+* [Day 106](https://github.com/vaskoz/dailycodingproblem-go/issues/223)
diff --git a/day106/problem.go b/day106/problem.go
new file mode 100644
index 0000000..4f35dbe
--- /dev/null
+++ b/day106/problem.go
@@ -0,0 +1,13 @@
+package day106
+
+// CanHopToEnd can you hop from 0 to the end.
+func CanHopToEnd(hops []int) bool {
+	start, end := 0, len(hops)-1
+	for start < end {
+		if hops[start] == 0 {
+			break
+		}
+		start += hops[start]
+	}
+	return start == end
+}


Test patch:
diff --git a/day106/problem_test.go b/day106/problem_test.go
new file mode 100644
index 0000000..cbed1fc
--- /dev/null
+++ b/day106/problem_test.go
@@ -0,0 +1,28 @@
+package day106
+
+import "testing"
+
+var testcases = []struct {
+	hops     []int
+	expected bool
+}{
+	{[]int{2, 0, 1, 0}, true},
+	{[]int{1, 1, 0, 1}, false},
+}
+
+func TestCanHopToEnd(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := CanHopToEnd(tc.hops); result != tc.expected {
+			t.Errorf("For %v expected %v got %v", tc.hops, tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkCanHopToEnd(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			CanHopToEnd(tc.hops)
+		}
+	}
+}