You are given an m x n matrix. The task is to return an array that contains all the elements of the matrix in diagonal order, starting from the top-left and moving diagonally towards the bottom-right. The diagonal order alternates between upward and downward diagonals.
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.
Given an equation with a variable ‘x’ and basic arithmetic operations (’+’, ‘-’), find the value of ‘x’. The equation might have a solution, no solution, or infinite solutions. Your task is to return the correct result in the form of a string.
You are given an array of integers representing asteroids in a row. Each asteroid has a size and a direction, with positive integers representing asteroids moving right and negative integers representing asteroids moving left. You need to determine the state of the asteroids after all collisions.
You are given an integer array arr. A mountain array is an array where the elements first strictly increase to a peak and then strictly decrease after that peak. Your task is to find the length of the longest mountain subarray in the given array. If no such subarray exists, return 0.