package
Version:
v0.0.0-...-75ded5f
Opens a new window with list of versions in this module.
Published: Feb 28, 2026
License: BSD-3-Clause
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
NAME
shiftzeros - shift zeros to the end of a collection
PROBLEM
Given an array of numbers, perform in place move of zeros to the end of the array. Maintain the relative order of non-zero elements.
EXAMPLE
Input: [0, 1, 0, 3, 2]
Output: [1, 3, 2, 0, 0]
SEE ALSO
Solution
Documentation
¶
package main
import (
"fmt"
"github.com/skhal/lab/iq/5/shiftzeros"
)
func main() {
nn := []int{0, 1, 0, 3, 2}
shiftzeros.Shift(nn)
fmt.Printf("%v\n", nn)
}
Output:
[1 3 2 0 0]
Source Files
¶
Click to show internal directories.
Click to hide internal directories.