You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 22, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+29-6Lines changed: 29 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ Write a function `jump_out_of_array` that outputs
44
44
* the amount of jumps until you jump out of the array
45
45
*`-1` when you reach the end of the array but do not jump out
46
46
47
-
**Requirements:**
47
+
**Requirements:**
48
48
* Array size is indefinite
49
49
* Array elements are integers, positive and negative
50
50
@@ -54,12 +54,35 @@ Given an array of `A[2, 3, -1, 1, 6, 4]`.
54
54
55
55

56
56
57
-
* Jump 1: A[0] + 2 = A[2]
58
-
* Jump 2: A[2] + (-1) = A[1]
59
-
* Jump 3: A[1] + 3 = A[4]
60
-
* Jump 4: A[4] + 6 = out of range
57
+
* Jump 1: `A[0]` + `2` = `A[2]`
58
+
* Jump 2: `A[2]` + `(-1)` = `A[1]`
59
+
* Jump 3: `A[1]` + `3` = `A[4]`
60
+
* Jump 4: `A[4]` + `6` = out of range
61
+
62
+
So the result is `4`, you need `4` jumps to jump out of the array.
63
+
64
+
### Task 5
65
+
66
+
Find the k-complement pairs in an array of a given number. Write a function `k_complement` that that outputs the amount
67
+
of pairs.
68
+
69
+
**Requirements:**
70
+
71
+
_Do not_ use nested loops to solve this problem, because of a time complexity of the loop solution.
72
+
[Check this thread](https://stackoverflow.com/questions/11032015/how-to-find-time-complexity-of-an-algorithm) to see what time complexity of an algorithm means.
73
+
74
+
75
+
**Example:**
76
+
77
+
Given a number `6` and an array `A[1, 8, -3, 0, 1, 3, -2, 4, 5]` the amount of pairs is `7`.
61
78
62
-
So the result is `4`, you need 4 jumps to jump out of the array.
0 commit comments