Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

202
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Juan Pablo Isaza Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda