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

203
Vistas
Code/Algorithm for Logical Expression Simplifier

I'm building a logical expression from multiple inputs and combining them with an OR, so my expression becomes something like below

(1 AND 2 AND 3 AND 4 AND (50 OR 51) AND 7 AND 8)
OR
(1 AND 2 AND 3 AND 41 AND (50 OR 51) AND 71)

There are many repetitive elements in it which can be combined to build the optimal & final logical expression as

(1 AND 2 AND 3 AND (50 OR 51) AND ((4 AND 7 AND 8) OR (41 AND 71)))

Is there any way by which this can be done? I'm currently building this as a string into javascript but any generic algorithm would help which I can apply to trim my logical expression

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

0

This is a classical problem, read https://en.wikipedia.org/wiki/Quine%E2%80%93McCluskey_algorithm

about 4 years ago · Juan Pablo Isaza Denunciar

0

Be careful, the simplified expression you gave is wrong

Correction :

(1 && 2 && 3 && (50 || 51) && ((4 && 7 && 8) || (41 && 71)) )


1, 2 and 3 must always be true
50 or 51 must be true
4 us true (and 41 false) => 7 and 8 must be true
4 is false but 41 is true => 71 must be true
4 and 41 are both true => 71 or (7 and 8) must be true

Hope is helps you ;)

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