This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <unistd.h> /* for sleep() */ | |
#include <curses.h> | |
int main(){ | |
WINDOW*mainWin = initscr(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include<iostream> | |
# include<ncurses.h> | |
#include<unistd.h> | |
using namespace std; | |
int R; | |
int C; | |
//Init the N-Curses System | |
WINDOW *mainWin; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<cstring> | |
using namespace std; | |
#define ll long long | |
ll a[1000005], prefixSum[1000005]; | |
int main(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<cstdio> | |
#include<climits> | |
using namespace std; | |
#define MAX 54000 | |
#define INT_MIN -22121 | |
struct treeNode{ | |
int prefixSum; | |
int suffixSum; | |
int sum; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); | |