Skip to content

Conversation

@monkukui
Copy link
Owner

@monkukui monkukui commented Dec 15, 2021

Ramge Maxima Query の場合

- a := make([]interface{}, n)
+ a := make([]int, n)
for i := 0; i < n; i++ {
	a[i] = io.NextInt()
}
- op := func(a, b interface{}) interface{} {
+ op := func(a, b int) int {
- 	aa, _ := a.(int)
- 	bb, _ := b.(int)
	if aa > bb {
		return aa
	}
	return bb
}
- e := func() interface{} {
+ e := func() int {
	return -1
}
- seg := NewBySlice(op, e, a)
+ seg := NewBySlice[int](op, e, a)

@monkukui monkukui requested a review from nu50218 as a code owner December 15, 2021 06:46
)

type SegTree struct {
type SegTree[T any] struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
expected ']', found any (typecheck)

@monkukui monkukui marked this pull request as draft December 15, 2021 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants