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

Issue:
Day 212
Good morning! Here's your coding interview problem for today.

This problem was asked by Dropbox.

Spreadsheets often use this alphabetical encoding for its columns: "A", "B", "C", ..., "AA", "AB", ..., "ZZ", "AAA", "AAB", ....

Given a column number, return its alphabetical column id. For example, given 1, return "A". Given 27, return "AA".

Pull request:
Day212
Resolves #436.

Patch:
diff --git a/README.md b/README.md
index 0b8b1da..e490863 100644
--- a/README.md
+++ b/README.md
@@ -221,3 +221,4 @@ problems from
 * [Day 208](https://github.com/vaskoz/dailycodingproblem-go/issues/427)
 * [Day 210](https://github.com/vaskoz/dailycodingproblem-go/issues/432)
 * [Day 211](https://github.com/vaskoz/dailycodingproblem-go/issues/434)
+* [Day 212](https://github.com/vaskoz/dailycodingproblem-go/issues/436)
diff --git a/day212/problem.go b/day212/problem.go
new file mode 100644
index 0000000..2170881
--- /dev/null
+++ b/day212/problem.go
@@ -0,0 +1,23 @@
+package day212
+
+// SpreadsheetColumnName returns the name of the column
+// based on the ordinal position.
+func SpreadsheetColumnName(pos int) string {
+	if pos < 1 {
+		return ""
+	}
+	pos--
+	var ans []rune
+	for pos >= 0 {
+		ans = append(ans, 'A'+rune(pos%26))
+		pos /= 26
+		if pos == 0 {
+			pos = -1
+		}
+		pos--
+	}
+	for i := 0; i < len(ans)/2; i++ {
+		ans[i], ans[len(ans)-1-i] = ans[len(ans)-1-i], ans[i]
+	}
+	return string(ans)
+}


Test patch:
diff --git a/day212/problem_test.go b/day212/problem_test.go
new file mode 100644
index 0000000..732b7ab
--- /dev/null
+++ b/day212/problem_test.go
@@ -0,0 +1,37 @@
+package day212
+
+import "testing"
+
+var testcases = []struct {
+	pos  int
+	cell string
+}{
+	{1, "A"},
+	{27, "AA"},
+	{52, "AZ"},
+	{53, "BA"},
+	{78, "BZ"},
+	{79, "CA"},
+	{677, "ZA"},
+	{702, "ZZ"},
+	{703, "AAA"},
+	{0, ""},
+	{-10, ""},
+}
+
+func TestSpreadsheetColumnName(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := SpreadsheetColumnName(tc.pos); result != tc.cell {
+			t.Errorf("Expected %v, got %v", tc.cell, result)
+		}
+	}
+}
+
+func BenchmarkSpreadsheetColumnName(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			SpreadsheetColumnName(tc.pos)
+		}
+	}
+}
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 27
Good morning! Here's your coding interview problem for today.

This problem was asked by Facebook.

Given a string of round, curly, and square open and closing brackets, return whether the brackets are balanced (well-formed).

For example, given the string `"([])[]({})"`, you should return true.

Given the string `"([)]"` or `"((()"`, you should return false.

Pull request:
Day27
Resolves #63 .

Patch:
diff --git a/README.md b/README.md
index c999be4..e1beab5 100644
--- a/README.md
+++ b/README.md
@@ -40,3 +40,4 @@ problems from
 * [Day 24](https://github.com/vaskoz/dailycodingproblem-go/issues/57)
 * [Day 25](https://github.com/vaskoz/dailycodingproblem-go/issues/59)
 * [Day 26](https://github.com/vaskoz/dailycodingproblem-go/issues/61)
+* [Day 27](https://github.com/vaskoz/dailycodingproblem-go/issues/63)
diff --git a/day27/problem.go b/day27/problem.go
new file mode 100644
index 0000000..47fbc78
--- /dev/null
+++ b/day27/problem.go
@@ -0,0 +1,32 @@
+package day27
+
+// WellBalanced returns true if the brackets in the string are balanced and well-formed.
+// Runs in O(N) time where N is the number of runes. Using O(N/2) extra space.
+func WellBalanced(brackets string) bool {
+	openBrackets := make([]rune, 0, (len(brackets)/2)+1)
+	for _, r := range brackets {
+		if r == '(' || r == '[' || r == '{' {
+			openBrackets = append(openBrackets, r)
+		} else if r == ')' || r == ']' || r == '}' {
+			if len(openBrackets) == 0 {
+				return false
+			}
+			var pop rune
+			pop, openBrackets = openBrackets[len(openBrackets)-1], openBrackets[:len(openBrackets)-1]
+			if !IsMatch(pop, r) {
+				return false
+			}
+		}
+		if len(openBrackets) > len(brackets)/2 {
+			return false
+		}
+	}
+	return len(openBrackets) == 0
+}
+
+// IsMatch returns true if the left and right runes form a matching pair.
+func IsMatch(left, right rune) bool {
+	return (right == ')' && left == '(') ||
+		(right == ']' && left == '[') ||
+		(right == '}' && left == '{')
+}


Test patch:
diff --git a/day27/problem_test.go b/day27/problem_test.go
new file mode 100644
index 0000000..626f2ec
--- /dev/null
+++ b/day27/problem_test.go
@@ -0,0 +1,29 @@
+package day27
+
+import "testing"
+
+var testcases = []struct {
+	input    string
+	expected bool
+}{
+	{"([])[]({})", true},
+	{"([)]", false},
+	{"((()", false},
+	{"((())))", false},
+}
+
+func TestWellBalanced(t *testing.T) {
+	for _, tc := range testcases {
+		if result := WellBalanced(tc.input); result != tc.expected {
+			t.Errorf("Expected %v got %v for %v", tc.expected, result, tc.input)
+		}
+	}
+}
+
+func BenchmarkWellBalanced(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			WellBalanced(tc.input)
+		}
+	}
+}
Repository: KaTeX/KaTeX (js)

Issue:
Typo in macro definition
PR #2429 added support for AMS log-like symbols.
There is a typo in one of the macro definitions:
```
defineMacro("\\injlim", "\\DOTSB\\operatorname*{int\\,lim}");
```
The name should start with `inj`, not `int`.
The corresponding test contains the same typo.

Pull request:
fix: \injlim typo
Fixes #2458.

Patch:
diff --git a/docs/support_table.md b/docs/support_table.md
index 5ed5443b..922969f7 100644
--- a/docs/support_table.md
+++ b/docs/support_table.md
@@ -500,7 +500,7 @@ use `\ce` instead|
 |\inf|$\inf$||
 |\infin|$\infin$||
 |\infty|$\infty$||
-|\injlim|$\injlim$|`\injlim`|
+|\injlim|$\injlim$| `\injlim` |
 |\int|$\int$||
 |\intercal|$\intercal$||
 |\intop|$\intop$||
diff --git a/src/macros.js b/src/macros.js
index 7927842b..2d49348a 100644
--- a/src/macros.js
+++ b/src/macros.js
@@ -844,7 +844,7 @@ defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}");
 
 //////////////////////////////////////////////////////////////////////
 // From amsopn.sty
-defineMacro("\\injlim", "\\DOTSB\\operatorname*{int\\,lim}");
+defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}");
 defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}");
 defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}");
 defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}");


Test patch:
diff --git a/test/katex-spec.js b/test/katex-spec.js
index bae8f3f5..ad07172d 100644
--- a/test/katex-spec.js
+++ b/test/katex-spec.js
@@ -3440,7 +3440,7 @@ describe("A macro expander", function() {
     });
 
     it("should expand AMS log-like symbols as expected", () => {
-        expect`\injlim`.toParseLike`\operatorname*{int\,lim}`;
+        expect`\injlim`.toParseLike`\operatorname*{inj\,lim}`;
         expect`\projlim`.toParseLike`\operatorname*{proj\,lim}`;
         expect`\varlimsup`.toParseLike`\operatorname*{\overline{lim}}`;
         expect`\varliminf`.toParseLike`\operatorname*{\underline{lim}}`;
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 124
Good morning! Here's your coding interview problem for today.

This problem was asked by Microsoft.

You have 100 fair coins and you flip them all at the same time. Any that come up tails you set aside. The ones that come up heads you flip again. How many rounds do you expect to play before only one coin remains?

Write a function that, given n, returns the number of rounds you'd expect to play until one coin remains.

Pull request:
Day124
Resolves #255.

Patch:
diff --git a/README.md b/README.md
index 3f1fc11..170fce6 100644
--- a/README.md
+++ b/README.md
@@ -129,3 +129,4 @@ problems from
 * [Day 118](https://github.com/vaskoz/dailycodingproblem-go/issues/246)
 * [Day 120](https://github.com/vaskoz/dailycodingproblem-go/issues/248)
 * [Day 123](https://github.com/vaskoz/dailycodingproblem-go/issues/253)
+* [Day 124](https://github.com/vaskoz/dailycodingproblem-go/issues/255)
diff --git a/day124/problem.go b/day124/problem.go
new file mode 100644
index 0000000..c575240
--- /dev/null
+++ b/day124/problem.go
@@ -0,0 +1,11 @@
+package day124
+
+import "math"
+
+// FairCoinFlipDownToOne answers how many rounds
+// are necessary to reach one coin.
+// You put aside tails, and flip all heads on the next round.
+// How many rounds to reach just 1 coin.
+func FairCoinFlipDownToOne(coins int) int {
+	return int(math.Ceil(math.Log2(float64(coins))))
+}


Test patch:
diff --git a/day124/problem_test.go b/day124/problem_test.go
new file mode 100644
index 0000000..291c994
--- /dev/null
+++ b/day124/problem_test.go
@@ -0,0 +1,30 @@
+package day124
+
+import "testing"
+
+var testcases = []struct {
+	coins, rounds int
+}{
+	{100, 7},
+	{120, 7},
+	{130, 8},
+	{4, 2},
+	{8, 3},
+}
+
+func TestFairCoinFlipDownToOne(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if rounds := FairCoinFlipDownToOne(tc.coins); rounds != tc.rounds {
+			t.Errorf("For %v coins, expected %v rounds got %v", tc.coins, tc.rounds, rounds)
+		}
+	}
+}
+
+func BenchmarkFairCoinFlipDownToOne(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			FairCoinFlipDownToOne(tc.coins)
+		}
+	}
+}