Skip to content

Instantly share code, notes, and snippets.

View SuryaPratapK's full-sized avatar

Surya Pratap SuryaPratapK

  • Durgapur
View GitHub Profile
#include <iostream>
using namespace std;
int main() {
int tc;
cin>>tc;
while(tc--) //test cases
{
int N;
cin>>N;
#include <bits/stdc++.h>
using namespace std;
int main() {
//code
int tc;
cin>>tc;
while(tc--)
{
int n,l,r;
#include <bits/stdc++.h>
using namespace std;
int main() {
//code
int tc;
cin>>tc;
while(tc--)
{
int n,k;
// C++ linear time solution for stock span problem
#include <iostream>
#include <stack>
using namespace std;
// A stack based efficient method to calculate
// stock span values
void calculateSpan(int price[], int n, int S[])
{
// Create a stack and push index of first
// C++ program to demonstrate auto-complete feature
// using Trie data structure.
#include<bits/stdc++.h>
using namespace std;
// Alphabet size (# of symbols)
#define ALPHABET_SIZE (26)
// Converts key current character into index
// use only 'a' through 'z' and lower case
// { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
/* Function to check if the given graph contains cycle
* V: number of vertices
* adj[]: representation of graph
*/
// A Dynamic Programming based C++ program to find minimum
// number operations to convert str1 to str2
#include <bits/stdc++.h>
using namespace std;
// Utility function to find the minimum of three numbers
int min(int x, int y, int z)
{
return min(min(x, y), z);
}
#include <iostream>
using namespace std;
void findMajority(int arr[], int n)
{
// Number of bits in the integer
int len = sizeof(int) * 8;
// Variable to calculate majority element
int number = 0;
/* C++ Program for finding out
majority element in an array */
#include <bits/stdc++.h>
using namespace std;
/* Function to find the candidate for Majority */
int findCandidate(int a[], int size)
{
int maj_index = 0, count = 1;
for (int i = 1; i < size; i++)
// Program to find minimum number of platforms
// required on a railway station
#include<iostream>
#include<algorithm>
using namespace std;
// Returns minimum number of platforms reqquired
int findPlatform(int arr[], int dep[], int n)
{