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

Issue:
Day 201
Good morning! Here's your coding interview problem for today.

This problem was asked by Google.

You are given an array of arrays of integers, where each array corresponds to a row in a triangle of numbers. For example, `[[1], [2, 3], [1, 5, 1]]` represents the triangle:
```
  1
 2 3
1 5 1
```
We define a path in the triangle to start at the top and go down one row at a time to an adjacent value, eventually ending with an entry on the bottom row. For example, `1 -> 3 -> 5`. The weight of the path is the sum of the entries.

Write a program that returns the weight of the maximum weight path.

Pull request:
Day201
Resolves #415.

Patch:
diff --git a/README.md b/README.md
index 4fbad7a..2974ac2 100644
--- a/README.md
+++ b/README.md
@@ -211,3 +211,4 @@ problems from
 * [Day 198](https://github.com/vaskoz/dailycodingproblem-go/issues/408)
 * [Day 199](https://github.com/vaskoz/dailycodingproblem-go/issues/409)
 * [Day 200](https://github.com/vaskoz/dailycodingproblem-go/issues/411)
+* [Day 201](https://github.com/vaskoz/dailycodingproblem-go/issues/415)
diff --git a/day201/problem.go b/day201/problem.go
new file mode 100644
index 0000000..da5209a
--- /dev/null
+++ b/day201/problem.go
@@ -0,0 +1,25 @@
+package day201
+
+// MaxWeightPathTriangle returns the weight of the maximum weight path
+// as defined by the problem.
+// Runs in O(N) time.
+// Assumes a correct triangle as input.
+func MaxWeightPathTriangle(tri [][]int) int {
+	return maxWeightPathTriangleHelper(tri, 0, 0)
+}
+
+func maxWeightPathTriangleHelper(tri [][]int, row, col int) int {
+	if row == len(tri)-1 {
+		return tri[row][col]
+	}
+	left := maxWeightPathTriangleHelper(tri, row+1, col)
+	right := maxWeightPathTriangleHelper(tri, row+1, col+1)
+	return tri[row][col] + max(left, right)
+}
+
+func max(a, b int) int {
+	if a > b {
+		return a
+	}
+	return b
+}


Test patch:
diff --git a/day201/problem_test.go b/day201/problem_test.go
new file mode 100644
index 0000000..67af1ca
--- /dev/null
+++ b/day201/problem_test.go
@@ -0,0 +1,27 @@
+package day201
+
+import "testing"
+
+var testcases = []struct {
+	triangle  [][]int
+	maxWeight int
+}{
+	{[][]int{{1}, {2, 3}, {1, 5, 1}}, 9},
+}
+
+func TestMaxWeightPathTriangle(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := MaxWeightPathTriangle(tc.triangle); result != tc.maxWeight {
+			t.Errorf("Expected %v, got %v", tc.maxWeight, result)
+		}
+	}
+}
+
+func BenchmarkMaxWeightPathTriangle(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			MaxWeightPathTriangle(tc.triangle)
+		}
+	}
+}
Repository: sasstools/sass-lint (js)

Issue:
Wrong line numbers when stripping front matter
Per #897, sass-lint strips the front matter used in packages such as jekyll. However this causes the line numbers reported by the linter to be incorrect.

For example, running `sass-lint -v` (version 1.10.2) on `tests/sass/front-matter/front-matter.scss` will give:

```
front-matter.scss
  3:10  warning  Color 'red' should be written in its hexadecimal form #ff0000              no-color-keywords
  3:10  warning  Color literals such as 'red' should only be used in variable declarations  no-color-literals
```

Where the relevant line is actually line 6.

Pull request:
Preserve correct line numbers when front matter is stripped
This change corrects the line numbers reported by sass-lint when front matter (such as used by jekyll) is stripped. Fixes #1059.

`<DCO 1.1 Signed-off-by: Felipe Lacerda fegolac@gmail.com>`


Patch:
diff --git a/lib/groot.js b/lib/groot.js
index 1d2ee52..60a057e 100644
--- a/lib/groot.js
+++ b/lib/groot.js
@@ -15,7 +15,14 @@ module.exports = function (text, syntax, filename) {
 
   // if we're skipping front matter do it here, fall back to just our text in case it fails
   if (fm.test(text)) {
-    text = fm(text).body || text;
+    var withFrontMatter = fm(text);
+    // Replace front matter by empty lines, so that line numbers are preserved
+    var numEmptyLines = 2;
+    if (withFrontMatter.frontmatter !== '') {
+      numEmptyLines += withFrontMatter.frontmatter.split('\r\n|\r|\n').length;
+    }
+    var emptyLines = new Array(numEmptyLines + 1).join('\n');
+    text = emptyLines + withFrontMatter.body || text;
   }
 
   try {


Test patch:
diff --git a/tests/main.js b/tests/main.js
index 28131df..0a23191 100644
--- a/tests/main.js
+++ b/tests/main.js
@@ -173,6 +173,13 @@ describe('sass lint', function () {
       });
     });
 
+    it('should preserve line numbers after parsing a file with front matter', function (done) {
+      lintFile('front-matter/front-matter.scss', function (data) {
+        assert.equal(6, data.messages[0].line);
+        done();
+      });
+    });
+
     // ==============================================================================
     //  Parse Errors should return as lint errors
     // ==============================================================================
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 114
Good morning! Here's your coding interview problem for today.

This problem was asked by Facebook.

Given a string and a set of delimiters, reverse the words in the string while maintaining the relative order of the delimiters. For example, given "hello/world:here", return "here/world:hello"

Follow-up: Does your solution work for the following cases: "hello/world:here/", "hello//world:here"

Pull request:
Day114
Resolves #237 .

Patch:
diff --git a/README.md b/README.md
index bb8bb2d..6616b77 100644
--- a/README.md
+++ b/README.md
@@ -121,3 +121,4 @@ problems from
 * [Day 109](https://github.com/vaskoz/dailycodingproblem-go/issues/229)
 * [Day 110](https://github.com/vaskoz/dailycodingproblem-go/issues/231)
 * [Day 111](https://github.com/vaskoz/dailycodingproblem-go/issues/232)
+* [Day 114](https://github.com/vaskoz/dailycodingproblem-go/issues/237)
diff --git a/day114/problem.go b/day114/problem.go
new file mode 100644
index 0000000..b98391f
--- /dev/null
+++ b/day114/problem.go
@@ -0,0 +1,38 @@
+package day114
+
+import "strings"
+
+// ReverseWordsMaintainDelimters reverses the words in the string
+// while maintaining the relative order of the delimiters
+// Works only with two delimiters "/" or ":"
+// Runs in O(N) time and requires O(N) extra space to construct the result.
+func ReverseWordsMaintainDelimters(str string) string {
+	var start, end int
+	var words []string
+	var delimiters []string
+	for end <= len(str) {
+		if end == len(str) {
+			if str[end-1] != ':' && str[end-1] != '/' {
+				words = append(words, str[start:end])
+			}
+			break
+		}
+		if str[end] == '/' || str[end] == ':' {
+			delimiters = append(delimiters, string(str[end]))
+			words = append(words, str[start:end])
+			start = end + 1
+		}
+		end++
+	}
+	for i := 0; i < len(words)/2; i++ {
+		words[i], words[len(words)-1-i] = words[len(words)-1-i], words[i]
+	}
+	var result []string
+	if len(delimiters) != len(words) {
+		delimiters = append([]string{""}, delimiters...)
+	}
+	for i := range words {
+		result = append(result, delimiters[i], words[i])
+	}
+	return strings.Join(result, "")
+}


Test patch:
diff --git a/day114/problem_test.go b/day114/problem_test.go
new file mode 100644
index 0000000..e56f5fc
--- /dev/null
+++ b/day114/problem_test.go
@@ -0,0 +1,29 @@
+package day114
+
+import "testing"
+
+var testcases = []struct {
+	input, expected string
+}{
+	{"hello/world:here", "here/world:hello"},
+	{"hello/world:here/", "/here:world/hello"},
+	{"hello//world:here", "here/world/:hello"},
+	{"/hello//world:here/", "/here/world/:hello/"},
+}
+
+func TestReverseWordsMaintainDelimters(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := ReverseWordsMaintainDelimters(tc.input); result != tc.expected {
+			t.Errorf("Expected %v got %v", tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkReverseWordsMaintainDelimters(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			ReverseWordsMaintainDelimters(tc.input)
+		}
+	}
+}