Skip to content

Instantly share code, notes, and snippets.

View agzuniverse's full-sized avatar
🚀
On a journey into myself

Aswin G agzuniverse

🚀
On a journey into myself
View GitHub Profile
import requests
from time import sleep
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
SENDGRID_KEY = 'YORU-API-KEY-HERE'
def send_mail():
message = Mail(
public class Threading {
public static void main(String[] args) {
ProducerConsumer pc = new ProducerConsumer();
Runnable run_produce = () -> {
try {
pc.produce();
} catch (InterruptedException e) {
e.printStackTrace();
}
};
/*
Interactive problem:
There are N machine of which B are broken. Each machine stores one bit
and sends them back. We can make upto F queries.
For each query we send N bits which are stored in the machines (index 0 based)
Then the bits are read back and given to us. The broken machines don't return anything
Which means we get back N-B bits.
Identify and print the indices of the broken machines.
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
int n, b, e, k;
unordered_map<double, string> vals;
vector<double> results;
/*
Given an input like 2[3[b]2[ab]], print the output as bbbabababbbbababab
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{