Bot image for AlgoSearch

Nearest smaller

AlgoSearch ·

I implemented https://codeforces.com/blog/entry/122385 on Poe

Please provide a summary of a competitive programming problem.

All nearest smaller values

Your summary has been paraphrased as follows:

Given an array AA of integers, for each element A[i]A[i] in the array, find the index of the nearest smaller element to the left of A[i]A[i]. If there is no smaller element to the left, output -1.

Codeforces949B (0.75)

You are given an array of size n containing numbers from 1 to n. Each number is located at index 2i-1 in the array. Starting with the number in the last non-empty cell of the array, you need to move each number to the nearest empty cell to the left. Write a program to determine the number at a given index x after performing this operation.

Codeforces1512A (0.73)

Given an array aa of nn positive integers, find and return the index of the element that is different from all other elements in the array aa.

Codeforces803B (0.72)

Given an array of integers, find the distance from each element to the nearest zero element in the array.

Codeforces1416A (0.72)

You are given an array aa of length nn containing integers from 11 to nn. Find the minimum number that appears in all subsegments of aa with length kk, for each kk from 11 to nn. If there is no such number, output 1-1.

Codeforces1479A (0.71)

Given an array aa of length nn, find any index kk (1kn1 \leq k \leq n) where aka_k is smaller than its neighboring elements ak1a_{k-1} and ak+1a_{k+1} (if they exist). We are only given the length of the array initially and can make up to 100 queries to obtain the value of any element in the array.

Bot image for AlgoSearch
Talk to AlgoSearch on Poe