Regular Solutions Template - TPEC
Regular Solutions Template - TPEC
#include <stdio.h>
void print(int ar_size, int* ar) {
int i;
for(i=0; i<ar_size; i++) {
printf("%d ", ar[i]);
}
printf("\n");
}
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>
int _ar_size;
scanf("%d", &_ar_size);
int _ar[_ar_size], _ar_i;
for(_ar_i = 0; _ar_i < _ar_size; _ar_i++) {
scanf("%d", &_ar[_ar_i]);
}
insertionSort(_ar_size, _ar);
return 0;
}
insertionSort(_ar_size, _ar);
return 0;
}
insertionSort(_ar_size, _ar);
return 0;
}
int _ar_size,i,j,shifts=0;
scanf("%d", &_ar_size);
int _ar[_ar_size], _ar_i;
for(_ar_i = 0; _ar_i < _ar_size; _ar_i++) {
scanf("%d", &_ar[_ar_i]);
}
for(i=2;i<=_ar_size;i++)
{
insertionSort(i, _ar,&shifts);
}
printf("%d",shifts);
return 0;
}
Counting Sort 1
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
int n,i;
int b[100],a;
//……………..Insert Code Here…………….
return 0;
}
RECURSION AND BIT MANIPULATION
Crossword Puzzle
return 0;
}
Counter Game
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int isPow2(long unsigned int);
unsigned long int largePow(long unsigned int);
int main() {
int t,i,win;
long unsigned int n;
int main() {
int T,N,B,L,R,ML,MR,X,Y,P,Q;
scanf("%d",&T);
for(int i = 0; i < T; i++) {
scanf("%d",&N);
for(int j = 0; j < N; j++) {
scanf("%d",&B);
if(j) {
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main() {
int n;
scanf("%i", &n);
char* password = (char *)malloc(512000 * sizeof(char));
scanf("%s", password);
int answer = minimumNumber(n, password);
printf("%d\n", answer);
return 0;
}
Caesar Cipher
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
int n,i,j,k;
char ar[101];
unsigned char x;
scanf("%d",&n);
scanf("%s",ar);
scanf("%d",&k);
for(i=0;i<n;i++)
{
#include <stdio.h>
char s[10000];
int main()
{
gets(s);
int f[300]={0},ans=0,i;
int l=strlen(s);
for(i=0;i<l;i++)
{
}
if(ans!=26)
printf("not ");
printf("pangram\n");
return 0;
}
RANGE QUERIES
Prefix Sum Array
#include<stdio.h>
void display(int arr[], int n)
{
int i;
for (i=0;i<n;i++)
{
printf("\t %d ",arr[i]);
}
}
create_prefix_sum_array(arr, n);
#include<stdio.h>
#include<math.h>
int main(){
int n, i, arr[100], T[100] , a, b;
#include<stdio.h>
#include<math.h>