sliding_window

package
v0.0.0-...-a119377 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PlayMaxFruits

func PlayMaxFruits()

func PlayMaxSligingWindow

func PlayMaxSligingWindow()

func PlayMaxSubNonRepeating

func PlayMaxSubNonRepeating()

func PlaySlidingWindow

func PlaySlidingWindow()

func Play_longestRepeating

func Play_longestRepeating()

We have a string of length n, which consist only UPPER and LOWER CASE characters and we have a number k (always less than n and greater than 0). We can make at most k changes in our string such that we can get a sub-string of maximum length which have all same characters. Examples:

n = length of string k = changes you can make Input : n = 5 k = 2

str = ABABA

Output : maximum length = 5 which will be (AAAAA)

Input : n = 6 k = 4

str = HHHHHH

Output : maximum length=6 which will be(HHHHHH)

Types

type Deque

type Deque struct {
	// contains filtered or unexported fields
}

Double ended queue data structure.

func New

func New() *Deque

Creates a new, empty deque.

func (*Deque) Empty

func (d *Deque) Empty() bool

Checks whether the queue is empty.

func (*Deque) Left

func (d *Deque) Left() interface{}

Returns the leftmost element from the deque. No bounds are checked.

func (*Deque) PopLeft

func (d *Deque) PopLeft() (res interface{})

Pops out an element from the queue from the left. Note, no bounds checking are done.

func (*Deque) PopRight

func (d *Deque) PopRight() (res interface{})

Pops out an element from the queue from the right. Note, no bounds checking are done.

func (*Deque) PushLeft

func (d *Deque) PushLeft(data interface{})

Pushes a new element into the queue from the left, expanding it if necessary.

func (*Deque) PushRight

func (d *Deque) PushRight(data interface{})

Pushes a new element into the queue from the right, expanding it if necessary.

func (*Deque) Reset

func (d *Deque) Reset()

Clears out the contents of the queue.

func (*Deque) Right

func (d *Deque) Right() interface{}

Returns the rightmost element from the deque. No bounds are checked.

func (*Deque) Size

func (d *Deque) Size() int

Returns the number of elements in the queue.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL