You are given the head of a singly linked list. For each node in the list, find the value of the next node that has a strictly larger value than the current node. If no such node exists, return 0 for that node. Return the result as an array where the value at index i represents the next greater node for the i-th node.
You are given a string s, and your task is to return the lexicographically smallest subsequence of s that contains all the distinct characters of s exactly once. The subsequence must be in the same order as the original string, but the characters should not repeat.
You are given a list of integers representing the number of hours worked each day. A day is considered tiring if the number of hours worked is strictly greater than 8. A well-performing interval is an interval of days where the number of tiring days is strictly larger than the number of non-tiring days. Your task is to return the length of the longest well-performing interval.
You are given an array arr of positive integers. Consider all binary trees such that each node has either 0 or 2 children, the values of arr correspond to the values of each leaf in an in-order traversal of the tree, and the value of each non-leaf node is equal to the product of the largest leaf values in its left and right subtrees. Return the smallest possible sum of the values of the non-leaf nodes among all possible binary trees.
Given an integer array nums and a positive integer k, return the most competitive subsequence of nums of size k. A subsequence is more competitive than another if at the first position where they differ, the subsequence has a smaller number.