fix: reordering and fix of small errors
This commit is contained in:
parent
b7cba109ed
commit
6280172289
|
|
@ -10,7 +10,7 @@ class Node {
|
||||||
int data;
|
int data;
|
||||||
|
|
||||||
public Node(int d){
|
public Node(int d){
|
||||||
data = d;
|
this.data = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void appendToTail(int d){
|
void appendToTail(int d){
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# 8.3. Magic index
|
# 8.3. Magic index
|
||||||
|
|
||||||
## Given an array of **distinct** integers, find a magix index, ifo ne exists. A magic index in an array A is an index such that A[i] = 1
|
## Given an array of **distinct** integers, find a magix index, if one exists. A magic index in an array A is an index such that A[i] = 1
|
||||||
|
|
||||||
## First idea
|
## First idea
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
# 16.8. Contiguous sequence or Maximum subarray problem
|
# 16.8. Contiguous sequence or Maximum subarray problem
|
||||||
|
|
||||||
## Given an array of integers, both negative and positive, find the contiguous sequence with the largest sum. Return the sum
|
> Given an array of integers, both negative and positive, find the contiguous sequence with the largest sum. Return the sum
|
||||||
|
|
||||||
> example:
|
Example:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nums = [2, -8, 3, -2, 4, -10]
|
nums = [2, -8, 3, -2, 4, -10]
|
||||||
|
|
@ -101,4 +101,4 @@ We only want negative numbers inculded in the sequence when they are in the midd
|
||||||
|
|
||||||
My code is exactly the same as the solution! (except for some unecessary variables I had).
|
My code is exactly the same as the solution! (except for some unecessary variables I had).
|
||||||
|
|
||||||
If all numbers in the array are negative, can we consider a subsequence of length = 0 and thus maxval = 0? or does it need to have 1+ values? this is a good thing to consider with the interviewer.
|
If all numbers in the array are negative, can we consider a subsequence of length = 0 and thus maxval = 0? or does it need to have 1+ values? this is a good thing to consider with the interviewer.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue