Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 260
Good morning! Here's your coding interview problem for today.

This problem was asked by Pinterest.

The sequence `[0, 1, ..., N]` has been jumbled, and the only clue you have for its order is an array representing whether each number is larger or smaller than the last. Given this information, reconstruct an array that is consistent with it. For example, given `[None, +, +, -, +]`, you could return `[1, 2, 3, 0, 4]`.

Pull request description:
Day260
Resolves #533.

Patch:
diff --git a/README.md b/README.md
index 52f4045..9c8da9f 100644
--- a/README.md
+++ b/README.md
@@ -270,3 +270,4 @@ problems from
 * [Day 256](https://github.com/vaskoz/dailycodingproblem-go/issues/528)
 * [Day 257](https://github.com/vaskoz/dailycodingproblem-go/issues/529)
 * [Day 258](https://github.com/vaskoz/dailycodingproblem-go/issues/530)
+* [Day 260](https://github.com/vaskoz/dailycodingproblem-go/issues/533)
diff --git a/day260/problem.go b/day260/problem.go
new file mode 100644
index 0000000..c856bd3
--- /dev/null
+++ b/day260/problem.go
@@ -0,0 +1,25 @@
+package day260
+
+// Unjumble uses hints to unjumble the input and return the result.
+func Unjumble(hints []rune) []int {
+	result := make([]int, 0, len(hints)+1)
+	count := 0
+	for _, r := range hints {
+		if r == '+' {
+			count++
+		}
+	}
+	first := len(hints) - count
+	result = append(result, first)
+	small, large := first-1, first+1
+	for _, r := range hints {
+		if r == '+' {
+			result = append(result, large)
+			large++
+		} else {
+			result = append(result, small)
+			small--
+		}
+	}
+	return result
+}


Test patch:
diff --git a/day260/problem_test.go b/day260/problem_test.go
new file mode 100644
index 0000000..1e96a25
--- /dev/null
+++ b/day260/problem_test.go
@@ -0,0 +1,34 @@
+package day260
+
+import (
+	"reflect"
+	"testing"
+)
+
+// nolint
+var testcases = []struct {
+	hints    []rune
+	expected []int
+}{
+	{
+		[]rune{'+', '+', '-', '+'},
+		[]int{1, 2, 3, 0, 4},
+	},
+}
+
+func TestUnjumble(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := Unjumble(tc.hints); !reflect.DeepEqual(result, tc.expected) {
+			t.Errorf("Expected %v, got %v", tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkUnjumble(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			Unjumble(tc.hints)
+		}
+	}
+}