remove

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

NAME

13 - remove elements from singly linked list

DESCRIPTION

Problem

Remove last n-th item from a singly linked list.

Example:

Input: [1 2 3 4 5] and n is 3

Output: [1 2 4 5]

SEE ALSO

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func LastNth

func LastNth(l *List, n int)
Example
package main

import (
	"fmt"

	"github.com/skhal/lab/iq/13/remove"
)

func main() {
	l := remove.NewList(1, 2, 3, 4, 5)
	remove.LastNth(l, 3)
	fmt.Println(l)
}
Output:
[1 2 4 5]

Types

type List

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

func NewList

func NewList(nn ...int) *List

func (*List) Slice

func (l *List) Slice() []int

func (*List) String

func (l *List) String() string

type Node

type Node struct {
	Value int
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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