3SAT instance with EXACTLY 3 instances of each literal

I’m trying to solve a question which requires me to:

  1. prove that an instance of 3SAT where each literal appears in exactly 3 clauses (positive and negative appearances combined).

  2. Find a polynomial time algorithm to find a satisfying assignment for it.

My Solution

I’m not sure how to prove part 1. I’m trying to solve 2 by reducing it to an instance of Vertex Cover in which each literal has 2 nodes – one positive, one negative – and each node is connected to the other literals its in a clause with. A vertex cover of size m = # of literals will give us the assignment needed.

Im not sure of I’m along the right path or not? Any help would be appreciated!

How is the literal meaning of “rendezvous” related to its usage in distributed computing?

I am trying to figure out the difference between RPC and Rendezvous. Is it correct that they differ only on their implementation on server side: RPC will involve creating a new process/thread to handle a request, and Rendezvous will pick an existing process/thread to handle a request?

The word “rendezvous” simply means a bunch of people meeting together. How is it related to its usage in computing?


ValueError: invalid literal for int() with base 10: ‘ ‘

Estou tentando fazer laços de repetição pra fazer uma lista porem estou com esse problema

listaNotas = []  for i in range(2):     nota = int(input("Digite uma nota: "))     listaNotas.append(nota)  print(listaNotas) 

Por que isso retorna um erro independente do que eu insiro no input?

nota = int(input(“Digite uma nota: “)) ValueError: invalid literal for int() with base 10: ”

mas isso nao?:

listaNotas = []   nota = int(input("Digite uma nota: ")) listaNotas.append(nota)  print(listaNotas) 

e se eu tiver mais do que um input,seja pra mesma variavel ou pra outra o mesmo erro ocorre

listaNotas = []   nota = int(input("Digite uma nota: ")) listaNotas.append(nota)  print(listaNotas)  nota2 = int(input("Digite uma nota: ")) listaNotas.append(nota2) 

ValueError: invalid literal for int() with base 10: ”

Ele lê o primeiro input e ja dá erro antes de inserir o segundo

Convert HTML input string to JavaScript Array literal

I am trying to accept JavaScript array literals in an HTML text input.

The problem is that HTML text inputs are captured as strings, such that an input of ['name', 'who', 1] becomes "['name', 'who', 1]".

My intention is for the following samples to yield the corresponding outputs.

"['river',"spring"]"        //  ["river","spring"]  "[{key:'value'},20,'who']"  //  [{"key":"value"},20,"who"] 

The way I worked around the problem is by using eval in the code snippet below:

const form = document.querySelector('.form');      const inputField = document.querySelector('.input');     const btnParse= document.querySelector('.btn');      const out = document.querySelector('.out');           form.addEventListener('submit', (e)=> {          e.preventDefault();         try {             parsed = eval(inputField.value);          if(Array.isArray(parsed)) {                  out.textContent = JSON.stringify(parsed);         } else throw new Error('input is  not a valid array' );       } catch(err) {         out.textContent = `Invalid input: $  {err.message}`;       }      }); 
 <form class="form">          <fieldset>          <legend>Enter array to parse</legend>               <input class="input" type="text">               <input class="btn" type="submit" value="parse">         </fieldset>     </form>     <div>          <p class="out">        </p>      </div>        

My solution, however, allows for the execution of any Javascript code inputted into the text field, which is a huge vulnerability.

What alternative way is there to converting JavaScript array literal HTML text inputs into JS array objects without using eval?