| Conditions | 6 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 42 | public static function isPalindrome2(ListNode $head): bool |
||
| 43 | { |
||
| 44 | $node = $head; |
||
| 45 | $queue = []; |
||
| 46 | while ($node) { |
||
| 47 | array_push($queue, $node); |
||
| 48 | $node = $node->next; |
||
| 49 | } |
||
| 50 | while (count($queue) >= 2) { |
||
| 51 | [$p, $q] = [array_shift($queue), array_pop($queue)]; |
||
| 52 | if ($p && $q && $p->val != $q->val) { |
||
| 53 | return false; |
||
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | return true; |
||
| 58 | } |
||
| 73 |