Skip to content

Instantly share code, notes, and snippets.

View prateek27's full-sized avatar

Prateek Narang prateek27

View GitHub Profile
#include<iostream>
using namespace std;
int n=4;
int dist[10][10] = {
{0,20,42,25},
{20,0,30,34},
{42,30,0,10},
{25,34,10,0}
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h> /* for sleep() */
#include <curses.h>
int main(){
WINDOW*mainWin = initscr();
# include<iostream>
# include<ncurses.h>
#include<unistd.h>
using namespace std;
int R;
int C;
//Init the N-Curses System
WINDOW *mainWin;
#include<iostream>
#define DONE (1<<n)-1
using namespace std;
int ans =0;
void solve(int row,int ld,int rd,int n){
if(row==DONE){ ans++;return;}
int pos = DONE &(~(row|ld|rd));
#include<iostream>
using namespace std;
int n=4;
int dist[10][10] = {
{0,20,42,25},
{20,0,30,34},
{42,30,0,10},
{25,34,10,0}
#include<iostream>
#include<cstring>
using namespace std;
#define ll long long
ll a[1000005], prefixSum[1000005];
int main(){
@prateek27
prateek27 / gss1.cpp
Created July 11, 2017 12:10
gss1.cpp
#include<iostream>
#include<cstdio>
#include<climits>
using namespace std;
#define MAX 54000
#define INT_MIN -22121
struct treeNode{
int prefixSum;
int suffixSum;
int sum;
#include <iostream> // std::cout
#include <queue> // std::priority_queue
#include <vector> // std::vector
#include <functional> // std::greater
#include<cstdio>
#include<climits>
using namespace std;
class mycomparison
{
bool reverse;
#include<bits/stdc++.h>
using namespace std;
// Utility function to check if current minimum value
// is feasible or not.
bool isPossible(int arr[], int n, int m, int curr_min)
{
int studentsRequired = 1;
int curr_sum = 0;
void sortInWave(int arr[], int n)
{
// Traverse all even elements
for (int i = 0; i < n; i+=2)
{
//Create Peaks at even positions -
// Peak element will be greater than prev and next element
if (i>0 && arr[i-1] > arr[i] )
swap(&arr[i], &arr[i-1]);