Skip to content

Instantly share code, notes, and snippets.

View gatij's full-sized avatar

GATIJ JAIN gatij

View GitHub Profile
#include<bits/stdc++.h>
using namespace std;
#define INF 1e18
struct node
{
long long value;
long long delta;
};
@gatij
gatij / SegTree_RMQ_blog_1.cpp
Created August 18, 2018 06:55
Range Minimum Query Segment Tree c++ implementation
#include<bits/stdc++.h>
using namespace std;
class SegmentTree{
long long n;
vector<long long>A,st;
long long left(long long p)
{
return (p<<1);
function getTokens(rawString) {
// NB: `.filter(Boolean)` removes any falsy items from an array
return rawString.toLowerCase().split(/[ ,!.";:-]+/).filter(Boolean).sort();
}
function mostFrequentWord(text) {
var words = getTokens(text);
var wordFrequencies = {};
for (var i = 0; i <= words.length; i++) {
if (words[i] in wordFrequencies) {
https://jsbin.com/yimediv/edit?html,css,js,output
https://jsbin.com/yefateg/edit?html,css,js,output
function wisePerson(wiseType, whatToSay) {
// your code here
var expected = 'A wise ' + wiseType + ' once said: "' +
whatToSay + '".';
return expected;
}
/* From here down, you are not expected to
understand.... for now :)
https://jsbin.com/botitik/1/edit?html,js,console,output