Skip to content

Commit 7c1aa6b

Browse files
committed
updated readme question
1 parent f498d91 commit 7c1aa6b

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

Arrays and Strings/README.md

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,21 @@
7878

7979
The above array has n + 2 = 7 elements with all elements occurring once except 2 and 4 which occur twice. So the output should be 4 2.
8080

81+
#### 13. [Find the Equilibrium index in an array (equilibriumIndexInArray))](C++/equilibriumIndexInArray.cpp)
8182

83+
Equilibrium index of an array is an index such that the sum of elements at lower indexes is equal to the sum of elements at higher indexes.
84+
A[] = {-7,1,5,2,-4,3,0}
85+
3 is an equilibrium index, because:
86+
A[0] + A[1] + A[2] = A[4] + A[5] + A[6]
8287

8388

89+
#### 13. [Check if array elements are consecutive (consecutiveCheckArray))](C++/consecutiveCheckArray.cpp)
90+
91+
Given an unsorted array of numbers, write a function that returns true if array consists of consecutive numbers
92+
a) If array is {5, 2, 3, 1, 4}, then the function should return true because the array has consecutive numbers from 1 to 5.
93+
b) If array is {83, 78, 80, 81, 79, 82}, then the function should return true because the array has consecutive numbers from 78 to 83.
94+
c) If the array is {34, 23, 52, 12, 3 }, then the function should return false because the elements are not consecutive.
95+
8496

8597
TODO :
8698

@@ -96,24 +108,6 @@ Output = {12, 34, 8, 90, 45, 9, 3}
96108

97109

98110

99-
* Equilibrium index of an array
100-
Equilibrium index of an array is an index such that the sum of elements at lower indexes is equal to the sum of elements at higher indexes. For example, in an arrya A:
101-
102-
A[0] = -7, A[1] = 1, A[2] = 5, A[3] = 2, A[4] = -4, A[5] = 3, A[6]=0
103-
104-
3 is an equilibrium index, because:
105-
A[0] + A[1] + A[2] = A[4] + A[5] + A[6]
106-
107-
* Check if array elements are consecutive | Added Method 3
108-
Given an unsorted array of numbers, write a function that returns true if array consists of consecutive numbers.
109-
110-
Examples:
111-
a) If array is {5, 2, 3, 1, 4}, then the function should return true because the array has consecutive numbers from 1 to 5.
112-
113-
b) If array is {83, 78, 80, 81, 79, 82}, then the function should return true because the array has consecutive numbers from 78 to 83.
114-
115-
c) If the array is {34, 23, 52, 12, 3 }, then the function should return false because the elements are not consecutive.
116-
117111

118112
* Find the smallest missing number
119113
Given a sorted array of n integers where each integer is in the range from 0 to m-1 and m > n. Find the smallest number that is missing from the array.

0 commit comments

Comments
 (0)