Skip to content

Instantly share code, notes, and snippets.

View mgabrielmarin's full-sized avatar
🦉

Gabriel Marin mgabrielmarin

🦉
  • Romania
View GitHub Profile
@mgabrielmarin
mgabrielmarin / stack.c
Created November 28, 2025 18:25
Stack implementation using linked list
/* Stack implemetation using linked list */
#include <stdio.h>
#include <stdlib.h>
struct node {
int data;
struct node *next;
};
struct node *createNode(int data) {
/* Que implementation using linked list */
#include <stdio.h>
#include <stdlib.h>
struct node {
int data;
struct node *next;
};
struct node *createNode(int data) {
#include <stdio.h>
#include <stdlib.h>
void swap(int *a, int *b) {
int tmp = *a;
*a = *b;
*b = tmp;
}
int partition(int *a, int l, int h) {
/* Sliding window algorithm
*
* Implementation of the examples from:
* https://leetcode.com/explore/interview/card/leetcodes-interview-crash-course-data-structures-and-algorithms/703/arraystrings/4502/
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Find the longest sub-array that has
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
if (argc < 2)
fprintf(stderr, "Please provide a string\n");
const char *w = argv[1];
int i = 0;
int j = strlen(w)-1;
while (i < j) {
@mgabrielmarin
mgabrielmarin / life.java
Created October 27, 2025 21:26
Conway's Game of Life in Java
import java.awt.Graphics;
import java.awt.Color;
import java.awt.Canvas;
import javax.swing.JFrame;
public class life {
public static void main(String[] args) {
String title = "Conway's Game of Life";
Conway game = new Conway();
JFrame frame = new JFrame(title);