Difficult:Easy
題目
Given the root of a binary tree, return the postorder traversal of its nodes’ values.
Difficult:Medium
You are given the head of a singly linked-list. The list can be represented as:
1 | L0 → L1 → … → Ln - 1 → Ln |
Reorder the list to be on the following form:
1 | L0 → Ln → L1 → Ln - 1 → L2 → Ln - 2 → … |
You may not modify the values in the list’s nodes. Only nodes themselves may be changed.
Difficult:Medium
Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null.
There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, pos is used to denote the index of the node that tail’s next pointer is connected to (0-indexed). It is -1 if there is no cycle. Note that pos is not passed as a parameter.
Do not modify the linked list.
Difficult:Medium
Given head, the head of a linked list, determine if the linked list has a cycle in it.
There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, pos is used to denote the index of the node that tail’s next pointer is connected to. Note that pos is not passed as a parameter.
Return true if there is a cycle in the linked list. Otherwise, return false.