leetcode

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 GetSum

func GetSum(a, b int) int

func IsPalindrome

func IsPalindrome(s string) bool

IsPalindrome checks ASCII string without extra space

func IsPalindromeWithCompareStrings

func IsPalindromeWithCompareStrings(s string) bool

IsPalindromeWithCompareStrings checks ASCII string if reverse alphanameruc is equal

func IsPalindromeWithExtraSpace

func IsPalindromeWithExtraSpace(s string) bool

IsPalindromeWithExtraSpace checks ASCII string with building chars and comapre the chars from the same string It create an extra string to keep valid string

func IsPalindromeWithRE

func IsPalindromeWithRE(s string) bool

IsPalindromeWithRE checks ASCII string if reverse alphanameruc is equal

func ReorderList

func ReorderList(head *ListNode)

func Reverse

func Reverse(x int) int

7. Reverse Integer

Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0. Assume the environment does not allow you to store 64-bit integers (signed or unsigned).

Example 1:

Input: x = 123
Output: 321

Example 2:

Input: x = -123
Output: -321

Example 3:

Input: x = 120
Output: 21

Constraints:

-2^31 <= x <= 2^31 - 1

func TwoSum

func TwoSum(nums []int, target int) []int

Types

type KthLargest

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

func Constructor

func Constructor(k int, nums []int) KthLargest

func (*KthLargest) Add

func (this *KthLargest) Add(val int) int

type ListNode

type ListNode struct {
	Val  int
	Next *ListNode
}

type MedianFinder

type MedianFinder interface {
	AddNum(num int)
	FindMedian() float64
}

func NewMedianFinder

func NewMedianFinder(solution string) MedianFinder

type MedianFinderArray

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

func (*MedianFinderArray) AddNum

func (this *MedianFinderArray) AddNum(num int)

func (*MedianFinderArray) FindMedian

func (this *MedianFinderArray) FindMedian() float64

type MedianFinderHeap

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

func (*MedianFinderHeap) AddNum

func (this *MedianFinderHeap) AddNum(num int)

func (*MedianFinderHeap) FindMedian

func (this *MedianFinderHeap) FindMedian() float64

Jump to

Keyboard shortcuts

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