Skip to content

Instantly share code, notes, and snippets.

View raiyansarker's full-sized avatar
💤
Hibernating

Raiyan Sarker raiyansarker

💤
Hibernating
View GitHub Profile
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
#define __lcm(a, b) (1LL * ((a) / __gcd((a), (b))) * (b))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
@raiyansarker
raiyansarker / lcs.c
Created July 31, 2026 16:04
LCS, LIS in C
#include <stdio.h>
#include <string.h>
char a[100];
char b[100];
void trace(int n, char t[][n + 1], int i, int j) {
if (t[i][j] == 'u') {
trace(n, t, i - 1, j);
} else if (t[i][j] == 'l') {
#include <bits/stdc++.h>
using namespace std;
int main() {
string a, b; cin >> a >> b;
int m = a.size(), n = b.size();
vector<int> prev(n + 1, 0);
vector<int> curr(n + 1, 0);
for (int i = 1; i <= m; i++) {
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll change(int t, vector<int> &v, vector<int> &dp) {
if (t == 0) return 0;
ll m = INT_MAX;
if (dp[t] != -1) return dp[t];
#include <bits/stdc++.h>
using namespace std;
int main() {
int n; double c; cin >> n >> c;
// weight, value
vector<pair<int, int>> v;
double ans = 0;
while (n--) {
#include <stdio.h>
#define QUEUE_SIZE 100
#define STACK_SIZE 100
#define MAX_CONN 8
int queue[QUEUE_SIZE];
int front = -1, rear = -1;
int stack[STACK_SIZE];
#include <stdio.h>
#include <stdlib.h>
#define MAX 10
typedef struct Node {
int data;
struct Node *next;
} Node;
#include <stdio.h>
#include <stdlib.h>
typedef struct Node {
int data;
struct Node *left, *right;
} Node;
Node* createNode(int data) {
Node* n = (Node*)calloc(1, sizeof(Node));
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#define MAX_SIZE 100
typedef struct Stack {
int arr[MAX_SIZE];
int top;
#include <stdio.h>
#include <stdlib.h>
#define MAX_SIZE 100
typedef struct Stack {
int arr[MAX_SIZE];
int top;
} Stack;