We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 106015d commit 6b6875bCopy full SHA for 6b6875b
resolved/search-standard-on-word.go
@@ -0,0 +1,40 @@
1
+package resolved
2
+
3
+func SearchStandardOnWord(word string, errorsQtt int) bool {
4
+ const MINIMUN_LENGTH = 1
5
6
+ if word == "" || len(word) == MINIMUN_LENGTH {
7
+ return false
8
+ }
9
10
+ hashtable := make(map[string]int)
11
12
+ for _, character := range word {
13
+ char := string(character)
14
15
+ /*****
16
+ if _, ok := hashtable[char]; ok {
17
+ hashtable[char]++
18
+ } else {
19
+ hashtable[char] = 1
20
21
+ is similar to \/
22
+ **/
23
24
25
26
27
+ equalCharsQt := hashtable[string(word[0])]
28
29
+ errors := 0
30
31
+ for _, val := range hashtable {
32
+ if val != equalCharsQt {
33
+ errors++
34
+ if errors > errorsQtt {
35
36
37
38
39
+ return true
40
+}
0 commit comments