lht

package
v0.0.0-...-d229d73 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

https://leetcode.com/problems/find-common-characters/description/

Given an array A of strings made only from lowercase letters, return a list of all characters that show up in all strings within the list (including duplicates). For example, if a character occurs 3 times in all strings but not 4 times, you need to include that character three times in the final answer.

You may return the answer in any order.

Example 1:

Input: ["bella","label","roller"]
Output: ["e","l","l"]

Example 2:

Input: ["cool","lock","cook"]
Output: ["c","o"]

Note:

1 <= A.length <= 100
1 <= A[i].length <= 100
A[i][j] is a lowercase letter

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MyHashMap

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

func HashMapConstructor

func HashMapConstructor() MyHashMap

* Initialize your data structure here.

func (*MyHashMap) Get

func (this *MyHashMap) Get(key int) int

* Returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key

func (*MyHashMap) Put

func (this *MyHashMap) Put(key int, value int)

* value will always be non-negative.

func (*MyHashMap) Remove

func (this *MyHashMap) Remove(key int)

* Removes the mapping of the specified value key if this map contains a mapping for the key

type MyHashSet

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

func Constructor

func Constructor() MyHashSet

* Initialize your data structure here.

func (*MyHashSet) Add

func (this *MyHashSet) Add(key int)

func (*MyHashSet) Contains

func (this *MyHashSet) Contains(key int) bool

* Returns true if this set contains the specified element

func (*MyHashSet) Remove

func (this *MyHashSet) Remove(key int)

type Strings

type Strings []string

func (Strings) Len

func (this Strings) Len() int

func (Strings) Less

func (this Strings) Less(i, j int) bool

func (Strings) Swap

func (this Strings) Swap(i, j int)

Jump to

Keyboard shortcuts

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