You are given a set of coins with different denominations and a target amount. Your task is to determine the fewest number of coins required to make the target amount. If it’s not possible, return -1.
You are given an array of integers. Your task is to reorder the array such that the elements alternate between smaller and larger numbers. The sequence should follow the pattern nums[0] < nums[1] > nums[2] < nums[3] > nums[4]….
You are given the head of a singly linked list. Your task is to reorder the list such that all nodes at odd indices are grouped together followed by all nodes at even indices. The first node is considered to have an odd index, the second node is considered to have an even index, and so on. The relative order inside the odd and even groups should remain unchanged.
You are given a nested list of integers nestedList, where each element can either be an integer or a sublist containing integers or other sublists. Implement an iterator to flatten this nested list.
You are given an integer n. Your task is to break it into a sum of at least two positive integers such that the product of these integers is maximized. Return the maximum product that can be obtained.