Skip to content

Instantly share code, notes, and snippets.

View manosriram's full-sized avatar
💻
Building something useful.

Mano Sriram manosriram

💻
Building something useful.
View GitHub Profile
@manosriram
manosriram / Problem1.txt
Created July 15, 2021 13:39
Technical Round 2 - ManoSriram
int Solve(vector<int> a) {
map<int, int> mp;
For (int t=0;t<a.size();++t) {
++mp[a[t]];
If (mp[a[t]] > 1) return a[t];
}
Return -1;
}
@manosriram
manosriram / ssl_nginx.md
Created June 6, 2020 07:55
SSL Setup Nginx.
cd ~
sudo apt-get update

wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
apt-get purge python-virtualenv python3-virtualenv virtualenv
pip install virtualenv
mv /.pip/pip.conf /.pip/pip.conf.backup
sudo ./certbot-auto --no-self-upgrade --nginx
@manosriram
manosriram / squareRootDecomposition.cpp
Last active October 3, 2019 05:06
Square Root Decomposition.
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
/*
Square Root Decomposition is used for "Range Querying" with the Time Complexity of O(sqrt(n)).
We Decompose the array into 'ceil(sqrt(n))' blocks. We calculate the result for each Block and store them.
When Updating (given the index), we change the value at that index to the new value. We also have to
void buildTreeMinSum(int *a, int *tree, int start, int end, int treeNode)
{
if (start == end)
{
tree[treeNode] = a[start];
return;
}
int mid = (start + end) / 2;