Skip to content

Instantly share code, notes, and snippets.

Avatar

Deepak yadav yDeepak1889

View GitHub Profile
View DigitalOcean_NoVNC_Paste.js
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1
@yDeepak1889
yDeepak1889 / gcd1_sparseTable.cpp
Created Feb 24, 2017
number of (l, r) such that 0<=l <= r <= n-1 and gcd(arr[l], arr[l+1] . . . arr[r]) = 1 using sparse table
View gcd1_sparseTable.cpp
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define mk(a, b) make_pair(a, b)
#define pr(n) printf("%d\n", n)
#define sc(n) scanf ("%d", &n)
@yDeepak1889
yDeepak1889 / sparseTable_gcdArray.cpp
Created Feb 24, 2017
find gcd between l and r in an array using sparse table
View sparseTable_gcdArray.cpp
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define mk(a, b) make_pair(a, b)
#define pr(n) printf("%d\n", n)
#define sc(n) scanf ("%d", &n)
@yDeepak1889
yDeepak1889 / sparseTable_sumArray.cpp
Created Feb 24, 2017
Find sum of elements of array between l and r
View sparseTable_sumArray.cpp
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define mk(a, b) make_pair(a, b)
#define pr(n) printf("%d\n", n)
#define sc(n) scanf ("%d", &n)
@yDeepak1889
yDeepak1889 / sparseTable_minArray.cpp
Created Feb 24, 2017
Find Minimum between l ans r ( 0<=l <=r <=n-1) using sparse Table
View sparseTable_minArray.cpp
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define mk(a, b) make_pair(a, b)
#define pr(n) printf("%d\n", n)
#define sc(n) scanf ("%d", &n)
You can’t perform that action at this time.