str

package
v0.0.0-...-bced520 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBinary

func AddBinary(a string, b string) string

AddBinary return sum of given string as a binary string.

func AddString

func AddString(num1 string, num2 string) string

AddString return the sum of num1 and num2, also represented as a string.

func BalancedString

func BalancedString(s string) int

func CheckIfPangram

func CheckIfPangram(sentence string) bool

CheckIfPangram reports whether sentence is pangram.

func CheckInclusion

func CheckInclusion(s1 string, s2 string) bool

CheckInclusion returns true if s2 contains the permutation of s1.

func ConvertToTitle

func ConvertToTitle(column int) string

ConvertToTitle returns corresponding column title as it appears in an Excel sheet. e.g. A -> 1, B -> 2 , C -> 3,Z -> 26 AA -> 27, AB -> 28

func CountDaysTogether

func CountDaysTogether(arriveAlice string, leaveAlice string, arriveBob string, leaveBob string) int

func DigitCount

func DigitCount(num string) bool

DigitCount returns true if for every index i in the range 0 <= i < n, the digit i occurs num[i] times in num, otherwise return false.

func Evaluate

func Evaluate(s string, knowledge [][]string) string

Evaluate evaluates all the bracket pairs with key in knowledge.

func IsIsomorphic

func IsIsomorphic(s string, t string) bool

IsIsomorphic returns true if all occurrences of a character in s can be replaced with another character while preserving the order of characters in t.

func IsPalindrome

func IsPalindrome(s string) bool

IsPalindrome returns true if s is palindrome.

It will convert all uppercase letters into lowercase letters and removing all non-alphanumeric characters.

func LengthOfLastWord

func LengthOfLastWord(s string) int

LengthOfLastWord returns the length of the last word in the string. A word is a maximal substring consisting of non-space characters only.

func LengthOfLongestSubstring

func LengthOfLongestSubstring(s string) int

LengthOfLongestSubstring returns the length of the longest substring without repeating characters. link: https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/

func LetterCombinations

func LetterCombinations(digits string) []string

func LongestCommonPrefix

func LongestCommonPrefix(strs []string) string

LongestCommonPrefix returns the longest common prefix string amongst an array of strings.

func NumbersAscending

func NumbersAscending(s string) bool

NumbersAscending returns true if all the numbers in s are strictly increasing from left to right. A sentence is a list of tokens separated by a single space with no leading or trailing spaces.

func Partition

func Partition(s string) [][]string

Partition returns all possible palindrome partitioning of s.

func RomanToInt

func RomanToInt(s string) int

func SimplifyPath

func SimplifyPath(path string) string

func SplitWordsBySeparator

func SplitWordsBySeparator(words []string, separator byte) []string

SplitWordsBySeparator splits the words in the input slice by the given separator character. It returns a new slice containing the split words. If a word is empty after splitting, it is not included in the result. Example usage:

words := []string{"one.two.three", "four.five", "six"}
separator := '.'
result := SplitWordsBySeparator(words, separator)

// result will be []string{"one", "two", "three", "four", "five", "six"}

func TitleToNumber

func TitleToNumber(title string) int

TitleToNumber returns its corresponding column number.

Types

This section is empty.

Jump to

Keyboard shortcuts

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