| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 57 | public function getFrequencyReachedTwice(int $frequency = 0): int |
||
| 58 | { |
||
| 59 | $memory = [$frequency => 1]; |
||
| 60 | |||
| 61 | $found = false; |
||
| 62 | while (!$found) { |
||
| 63 | foreach ($this->changes as $change) { |
||
| 64 | $frequency += $change; |
||
| 65 | |||
| 66 | if (isset($memory[$frequency])) { |
||
| 67 | $found = true; |
||
| 68 | break; |
||
| 69 | } |
||
| 70 | |||
| 71 | $memory[$frequency] = 1; |
||
| 72 | } |
||
| 73 | } |
||
| 74 | |||
| 75 | return $frequency; |
||
| 76 | } |
||
| 78 |