The append call is unnecessary, here is an improved version:
// PopBack will pop an element from the back of the dequeue
func (s *Deque) PopBack() int {
i := len(s.items) - 1
defer func() {
s.items = s.items[:i]
}()
return s.items[i]
}
Course: Grokking Coding Interview Patterns in Go - Learn Interactively
Lesson: Find Maximum in Sliding Window - Grokking Coding Interview Patterns in Go
Course: Grokking Coding Interview Patterns in Go - Learn Interactively
Lesson: Find Maximum in Sliding Window - Grokking Coding Interview Patterns in Go