problems

package
v0.0.0-...-4d3ad75 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KMinElement

func KMinElement(arr []int, k int) []int

KMinElement finds K smallest items from array

func ReverseBits

func ReverseBits(x uint8) uint8

ReverseBits reverse bits in x. The time complexity is O(n) where n is the word size. The space complexity is O(1).

func ShuffleArray

func ShuffleArray(in []int) []int

func TwoSums

func TwoSums(arr1, arr2 []int, target int) [][]int

func TwoSumsClosestBruetForce

func TwoSumsClosestBruetForce(arr1, arr2 []int, target int) [][]int

func TwoSumsClosestSorting

func TwoSumsClosestSorting(arr1, arr2 []int, target int) [][]int

Types

type IntMaxHeap

type IntMaxHeap []int

IntMaxHeap implements Max Heap

func (IntMaxHeap) Len

func (h IntMaxHeap) Len() int

func (IntMaxHeap) Less

func (h IntMaxHeap) Less(i, j int) bool

func (*IntMaxHeap) Max

func (h *IntMaxHeap) Max() int

Max returns head

func (*IntMaxHeap) Pop

func (h *IntMaxHeap) Pop() interface{}

Pop use pointer receivers because they modify the slice's length, not just its contents.

func (*IntMaxHeap) Push

func (h *IntMaxHeap) Push(x interface{})

Push use pointer receivers because they modify the slice's length, not just its contents.

func (IntMaxHeap) Swap

func (h IntMaxHeap) Swap(i, j int)

Jump to

Keyboard shortcuts

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