Skip to content

Instantly share code, notes, and snippets.

View rohith2506's full-sized avatar

Rohith Uppala rohith2506

View GitHub Profile
@rohith2506
rohith2506 / palindrome.cpp
Created April 26, 2013 04:14
palindrome partitioning (leetcode)
/*
"This is palindrome partitioning"
@author : rohit
*/
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <algorithm>
@rohith2506
rohith2506 / srm_570_3.cpp
Created February 17, 2013 12:38
Topcoder srm 570 div 2 level 3:- (actually this can be implemented as number of contiguous subsets of given tree )
/*
number of ways will be number of ways of its children can be arranged consecutively excluding
its root
*/
#include <iostream>
#include <stdio.h>
#include <vector>
#include <set>
#include <map>
@rohith2506
rohith2506 / 167_5.cpp
Created February 16, 2013 09:57
codeforces 167 div2 problem 5:- (a very nice problem)
#include<iostream>
#include<vector>
#include<set>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
ll n,m,a[333333],b[333333],x,y;
vector<ll>v[333333];
@rohith2506
rohith2506 / 167_4.cpp
Created February 15, 2013 12:22
codeforces 167 div 2 problem 4:-
#include <iostream>
#include <stdio.h>
#include <set>
#include <map>
#define MAX 100010
int a[MAX],b[MAX];
using namespace std;
set<int> s;
map<int,int> mp;
@rohith2506
rohith2506 / 167_3.cpp
Created February 14, 2013 11:46
codeforces 167 div 2 problem 3:-
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cmath>
typedef long long int ll;
using namespace std;
@rohith2506
rohith2506 / 167_2.cpp
Created February 14, 2013 10:46
codeforces 167 div2 problem B:-
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cmath>
typedef long long int LL;
#define MAX 100100
LL arr[MAX];
using namespace std;
@rohith2506
rohith2506 / robertherb.cpp
Last active December 13, 2015 17:58
Topcoder 570-div2 medium problem solution:-
#include <iostream>
#include <stdio.h>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
class Robertherb{
public:
@rohith2506
rohith2506 / prime_sieve.cpp
Created February 12, 2013 13:11
To calculate prime numbers using sieve of erosthenes
/*
to calculate prime numbers using sieve of erosthenes
@author:rohit
*/
#include <iostream>
#include <stdio.h>
#include <cmath>
@rohith2506
rohith2506 / max_sum.cpp
Created February 12, 2013 12:55
maximum sum sub sequence (dp solution)
/*
maximum sub sequence in an array(dp solution)
@author:rohit
*/
#include <iostream>
#include <stdio.h>
#include <vector>
@rohith2506
rohith2506 / longest_sub_sequence.cpp
Created February 12, 2013 12:40
Longest non decreasing sub sequence(dynamic programming)
/*
to find longest non decreasing subsequence (another classical dp problem)
@author:rohit
*/
#include <iostream>
#include <stdio.h>
#include <vector>
#define MAX 10001