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
/*
Given an input like 2[3[b]2[ab]], print the output as bbbabababbbbababab
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
#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;
/*
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.
public class Threading {
public static void main(String[] args) {
ProducerConsumer pc = new ProducerConsumer();
Runnable run_produce = () -> {
try {
pc.produce();
} catch (InterruptedException e) {
e.printStackTrace();
}
};
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(
#include <stdio.h>
float calcAvg(int a[], int n)
{
int total = 0;
for (int i = 0; i < n; i++)
total += a[i];
return (float)total / n;
}
{
"name": "test-project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
const path = require('path')
module.exports = {
"entry": "./src/index.js",
"output": {
path: path.resolve(__dirname, 'dist'),
filename: "bundle.js"
},
module: {
rules: [
{
"presets": ["@babel/preset-env", "@babel/preset-react"]
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>React App</title>
</head>
<body>
<div id="root"></div>