Ch | Ex | expected worst-case time complexity | expected worst-case space complexity* | Solution 1 | Solution 2 | Solution 3 | |
---|---|---|---|---|---|---|---|
1 | Iterations | BinaryGap | O(log(N)) | O(1) | Solution | ||
2 | Arrays | CyclicRotation | n/a | n/a | Solution | ||
OddOccurencesInArray | O(N) | O(1) | Solution | ||||
3 | Time Complexity | FrogJmp | O(1) | O(1) | Solution | ||
PermMissingElem | O(N) | O(1)* | Solution | ||||
TapeEquilibrium | O(N) | O(N)* | Solution | ||||
4 | Counting Elements | FrogRiverOne | O(N) | O(X) | Solution | ||
MissingInteger | O(N) | O(N) | Solution | ||||
PermCheck | O(N) | O(N) | frequency array | test by induction | |||
MaxCounters | O(N+M) | O(N) | lazy | ||||
5 | Prefix Sums | CountDiv | O(1) | O(1) | math trick | ||
PassingCars | O(N) | O(1) | solution | ||||
GenomicRangeQuery | O(N+M) | O(N) | solution | ||||
MinAvgTwoSlice | O(N) | O(N) | solution | ||||
6 | Sorting | MaxProductOfThree | O(N*log(N)) | O(1) | 77% | sorted() | |
Distinct | O(N*log(N)) | O(N) | sorted() | ||||
Triangle | O(N*log(N)) | O(N) | sorted() | ||||
NumberOfDiscIntersections | O(N*log(N)) | O(N) | solution | ||||
7 | Stacks & Queues | Nesting | O(N) | O(1) | solution | ||
Brackets | O(N) | O(N) | solution | ||||
Fish | O(N) | O(N) | stack pop() | ||||
StoneWall | O(N) | O(N) | stack pop() | ||||
8 | Leader | Dominator | "efficient" | "efficient" | 83% | 91% | stack |
EquiLeader | "efficient" | "efficient" | 55% | counts | |||
9 | Max Slice | MaxProfit | "efficient" | "efficient" | 88% | 100% | |
MaxSliceSum | "efficient" | "efficient" | 53% | 100% | |||
MaxDoubleSliceSum | "efficient" | "efficient" | modified Kadane's Algorithm | ||||
10 | Prime & Composite Numbers | CountFactors | "efficient" | "efficient" | 100% (O(sqrt(N)) | ||
MinPerimeterRectangle | "efficient" | "efficient" | 100% (O(sqrt(N)) | ||||
Peaks | "efficient" | "efficient" | 100% O(N*log(log(N))) | ||||
Flags | |||||||
11 | title | ex | t | s | s1 | s2 | s3 |
12 | title | ex | t | s | s1 | s2 | s3 |
13 | title | ex | t | s | s1 | s2 | s3 |
14 | title | ex | t | s | s1 | s2 | s3 |
15 | title | ex | t | s | s1 | s2 | s3 |
16 | title | ex | t | s | s1 | s2 | s3 |
17 | title | ex | t | s | s1 | s2 | s3 |
90 | title | ex | t | s | s1 | s2 | s3 |
91 | title | ex | t | s | s1 | s2 | s3 |
92 | title | ex | t | s | s1 | s2 | s3 |
99 | title | ex | t | s | s1 | s2 | s3 |
*not counting the storage required for input arguments