Skip to content

Instantly share code, notes, and snippets.

@ehaliewicz
ehaliewicz / 8queens.c
Created October 24, 2018 21:53
8queens
#include <stdio.h>
#include <stdint.h>
int columns[8] = {-1,-1,-1,-1,-1,-1,-1,-1};
int num_solutions = 0;
void print_queens() {
for(int y = 0; y < 8; y++) {
for(int x = 0; x < 8; x++) {
putchar(columns[x] == y ? 'Q' : '.');
@ehaliewicz
ehaliewicz / l.c
Created May 30, 2019 03:46
lambda
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef enum {
SUCCESS, // parsed
FAILURE, // didn't parse
ERROR // bad syntax
} status;
@ehaliewicz
ehaliewicz / calendar.go
Created March 31, 2021 18:27
calendar functions
func isLeap(y int) bool {
if y%4 == 0 {
if y%100 == 0 {
return y%400 == 0
}
return true
}
return false
}