Tap here to switch tabs
Problem
Submissions

Problem: Next Greater Node In Linked List

Try to solve the Next Greater Node In Linked List problem.

Statement

You are given the head of a singly linked list containing n nodes.

For each node in the list, find the value of the next greater node. The next greater node of a given node is the first node located after it in the list whose value is strictly greater than its value. If no subsequent node has a strictly greater value, the answer for that node is 00.

Return an array of integers representing the next greater node value for each node in the list, ordered from the first node to the last.

Constraints:

  • The number of nodes in the list is n.

  • 1≤1 \leq n ≤104\leq 10^4

  • 1≤1 \leq Node.val ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Next Greater Node In Linked List

Try to solve the Next Greater Node In Linked List problem.

Statement

You are given the head of a singly linked list containing n nodes.

For each node in the list, find the value of the next greater node. The next greater node of a given node is the first node located after it in the list whose value is strictly greater than its value. If no subsequent node has a strictly greater value, the answer for that node is 00.

Return an array of integers representing the next greater node value for each node in the list, ordered from the first node to the last.

Constraints:

  • The number of nodes in the list is n.

  • 1≤1 \leq n ≤104\leq 10^4

  • 1≤1 \leq Node.val ≤109\leq 10^9