Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

516
Vistas
Given 2 numbers N and Q followed by N numbers.Now Q inputs of 2 Numbers U and V are given. U indicates the starting index and V indicates the ending

Given 2 numbers N and Q followed by N numbers. Now Q inputs of 2 Numbers U and V are given. U indicates the starting index and V indicates the ending index. So for each U,V find the minimum of all values of the array from the index U to V(1 based indexing) Input Size: N<=100000 example

INPUT

5 3

1 1 1 1 1

1 3

2 4

3 4

OUTPUT

1

1

1

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can do something like this:

const N = 5;
const Q = 3;
const Numbers = [1, 1, 1, 1, 1];
const UVInputs = [[1, 3], [2, 4], [3, 4]];
const result = [];
for(let i = 0;i < Q;i++)
   result.push(Math.min(...Numbers.slice(UVInputs[i][0], UVInputs[i][1])));
console.log(result);
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda