Results for “Slices & collections”
Small, practical examples. Search by task or narrow things down below.
Copy a slice without sharing storage
Copy a slice without sharing storage using a complete Go program with explicit sample inputs.
Go✓ Tested
Deduplicate sorted values
Deduplicate sorted values using a complete Go program with explicit sample inputs.
Go✓ Tested
Filter values into a new slice
Filter values into a new slice using a complete Go program with explicit sample inputs.
Go✓ Tested
Find an item’s index
Find an item’s index using a complete Go program with explicit sample inputs.
Go✓ Tested
Iterate over bounded chunks
Iterate over bounded chunks using a complete Go program with explicit sample inputs.
Go✓ Tested
Preallocate a slice’s capacity
Preallocate a slice’s capacity using a complete Go program with explicit sample inputs.
Go✓ Tested
Remove a slice range
Remove a slice range using a complete Go program with explicit sample inputs.
Go✓ Tested
Reverse slice order
Reverse slice order using a complete Go program with explicit sample inputs.
Go✓ Tested
Sort integers in place
Sort integers in place using a complete Go program with explicit sample inputs.
Go✓ Tested
Combine collections as a distinct set
C#: Union retains each value once across both inputs.
C#✓ Tested
Find differences between two collections
PowerShell: Compare-Object marks reference-only values with a left arrow and difference-only values with a right arrow.
PowerShell✓ Tested
Find values common to two collections
C#: Intersect returns distinct values shared by the inputs.
C#✓ Tested