feat: add Go theory guides (terminology, algorithms, testing, debugging) and 2 new chapters
This commit is contained in:
1 parent
84be3e5d77
commit
011f23e637
13 files changed
+374
-3
No files matched your search
@@ -0,0 +1,14 @@
|
||||
# 11 — Algorytmy i Złożoność Obliczeniowa (`O(log n)`, `O(n)`)
|
||||
|
||||
Teoria: [notes/03-algorithms-and-complexity.md](../../../notes/03-algorithms-and-complexity.md)
|
||||
|
||||
## Zadania (`algorithms.go`)
|
||||
1. `BinarySearch(sorted []int, target int) (int, bool)` — wyszukiwanie binarne w `O(log n)` (zwróć indeks i `true`, lub `-1, false`).
|
||||
2. `TwoSum(nums []int, target int) (int, int, bool)` — znajdź parę indeksów `(i, j)` (`i < j`) dającą `nums[i] + nums[j] == target` w czasie `O(n)` przy pomocy `map[int]int`.
|
||||
3. `IsPalindrome(text string) bool` — metoda **dwóch wskaźników** (*two pointers*) na `[]rune`, ignorując wielkość liter i znaki niealfanumeryczne (`unicode.IsLetter`, `unicode.IsDigit`, `unicode.ToLower`).
|
||||
4. `MaxWindowSum(nums []int, k int) (int, bool)` — maksymalna suma spójnego podciągu długości `k` metodą **okna przesuwnego** (*sliding window*) w `O(n)`.
|
||||
|
||||
## Uruchomienie testów
|
||||
```bash
|
||||
make test PKG=./exercises/01-core/11-algorithms
|
||||
```
|
||||
Reference in new issue
Block a user