You are given a 0-indexed array of positive integers w, where w[i] describes the weight of the ith index. You need to implement the function pickIndex() which randomly picks an index in the range [0, w.length - 1] (inclusive), and the probability of picking index i is w[i] / sum(w).
Given an array of integers, you need to add parentheses in such a way that the division expression evaluates to the maximum possible value. The division must respect the adjacency of integers in the array.
Given a positive integer n, find the smallest integer which can be formed by rearranging the digits of n and is greater than n. If no such integer exists, return -1.
Given a string expression representing a mathematical expression with fractions involving addition and subtraction, compute the result of the expression. The result should be simplified and returned in the form of a fraction. If the result is an integer, represent it as a fraction with denominator 1.