Find the permutation

Cerinta completa Consider a permutation, , of integers from to . Let’s determine the of to be the minimum absolute difference between any consecutive integers in : Generate a lexicographically sorted list of all permutations of length having a maximal

Dynamic Array

Cerinta completa Declare a 2-dimensional array, , with empty arrays, all zero-indexed. Declare an integer, , and initialize it to 0. You need to process two types of queries: Query: Compute . Append the integer to . Query: Compute .

Costly Intervals

Cerinta completa Given an array, your goal is to find, for each element, the largest subarray containing it whose cost is at least . Specifically, let be an array of length , and let be the subarray from index to

Box Operations

Cerinta completa Alice purchased an array of wooden boxes that she indexed from to . On each box , she writes an integer that we’ll refer to as . Alice wants you to perform operations on the array of boxes.

Arithmetic Progressions

Cerinta completa Let denote an arithmetic progression (AP) with first term and common difference , i.e.  denotes an infinite . You are given APs => . Let denote the sequence obtained by multiplying these APs. Multiplication of two sequences is