MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / Length

Method Length

structure/stack/stackarray.go:27–29  ·  view source on GitHub ↗

Size returns the number of elements in the stack.

()

Source from the content-addressed store, hash-verified

25
26// Size returns the number of elements in the stack.
27func (s *Array[T]) Length() int {
28 return len(s.elements)
29}
30
31// Peek returns the top element of the stack without removing it.
32func (s *Array[T]) Peek() T {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected