Skip to content

Instantly share code, notes, and snippets.

View NikitaShkaruba's full-sized avatar

Nikita Shkaruba NikitaShkaruba

View GitHub Profile
/*
Solution:
- Backtracking: O(1) time, O(1) space
*/
func solveSudoku(board [][]byte) {
columns := initColumns(board)
rows := initRows(board)
squares := initSquares(board)
backtrack(board, columns, rows, squares, 0, 0)
### GIT ###
# Frequently used
git config --global alias.co checkout
git config --global alias.st status
git config --global alias.re reset
# Not frequently used
git config --global alias.ci commit
git config --global alias.br branch
#include <iostream>
using namespace std;
const int MAX_AMOUNT = 100000;
const int NOT_LEAF = -1;
pair<int, int> segment_tree[4 * MAX_AMOUNT];
int current_index = 1; // Этой контсантой даем листьям номера
{
"name": "SerialNumber",
"value": "477",
"related": {
"name": "type",
"value": "control",
"related": {
"name": "requiredAccessLevel",
"value": "4",
"related": {}
#include <iostream>
using namespace std;
// region Debug
// Если верен - на каждой итерации выводится не только её результат, но ещё и состояния всех бинов
bool debug = true;
/**
#include <stdio.h>
#include <malloc.h>
#include "main.h"
bmpHeader header_plug;
bmpHeader header;
image_t image;
int condition = 0;
int main(void) {
#include <stdio.h>
#include <malloc.h>
#include "main.h"
bmpHeader header_plug;
bmpHeader header;
image_t image;
int condition = 0;
int main(void) {
size_t width = image.height;
size_t height = image.width3;
char** pixels = (char**) calloc(height, sizeof(char*));
for (int i = 0; i < width; i ++) {
pixels[i] = (char*) calloc(width, sizeof(char));
}
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
int height = 10;
int width = 5;
int** double_array = new int*[height];
for (int i = 0; i < height; i++) {
double_array[i] = new int[width];
}