This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
min = 0 | |
max = 0 | |
sum = 0 | |
count = 0 | |
input = "" | |
def results(min,max,avg) | |
puts "End of program" | |
puts "-------------------------" | |
puts "The lowest number was: #{min}" | |
puts "The highest number was: #{max}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_solved(board) | |
all_nine = board.join.chars.map{|i| i.to_i} | |
all_lines = [] | |
all_lines << [all_nine[0],all_nine[1],all_nine[2]] | |
all_lines << [all_nine[0],all_nine[3],all_nine[6]] | |
all_lines << [all_nine[0],all_nine[4],all_nine[8]] | |
all_lines << [all_nine[2],all_nine[5],all_nine[8]] | |
all_lines << [all_nine[2],all_nine[4],all_nine[6]] | |
all_lines << [all_nine[1],all_nine[4],all_nine[7]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sudoku | |
SIZE = 9 | |
NUMBERS = (1..9).to_a | |
def initialize | |
@board = Array.new(SIZE) { Array.new(SIZE, nil) } | |
end | |
def [](x, y) | |
@board[y][x] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<unistd.h> | |
void ft_putchar(char c) | |
{ | |
write(1, &c, 1); | |
} | |
void ft_print_comb2(void) | |
{ | |
int a; | |
int b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STDOUT.sync = true # DO NOT REMOVE | |
$opp_units_initial = [] | |
# Find the farthest point in the field | |
def farthest(w, h, x, y) | |
far_x = x > w/2 ? 0 : w | |
far_y = y > h/2 ? 0 : h | |
{ x: far_x, y: far_y } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
def three_digit_to_words(num) | |
ones = %w[zero one two three four five six seven eight nine] | |
teens = %w[ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen] | |
tens = %w[ten twenty thirty forty fifty sixty seventy eighty ninety] | |
words = [] | |
if (num / 100).positive? | |
words << ones[num / 100].capitalize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ************************************************************************** */ | |
/* */ | |
/* ::: :::::::: */ | |
/* ft_split.c :+: :+: :+: */ | |
/* +:+ +:+ +:+ */ | |
/* By: kbenjel <[email protected]> +#+ +:+ +#+ */ | |
/* +#+#+#+#+#+ +#+ */ | |
/* Created: 2023/09/07 02:58:22 by kbenjel #+# #+# */ | |
/* Updated: 2023/09/08 03:59:10 by kbenjel ### ########.fr */ | |
/* */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ************************************************************************** */ | |
/* */ | |
/* ::: :::::::: */ | |
/* ft_print_combn.c :+: :+: :+: */ | |
/* +:+ +:+ +:+ */ | |
/* By: kbenjell <[email protected]> +#+ +:+ +#+ */ | |
/* +#+#+#+#+#+ +#+ */ | |
/* Created: 2024/07/26 12:53:33 by kbenjell #+# #+# */ | |
/* Updated: 2024/08/17 18:21:27 by kbenjell ### ########.fr */ | |
/* */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void print_tab(int *tab, int size); | |
void ft_swap(int *a, int *b) | |
{ | |
int tmp; | |
tmp = *a; | |
*a = *b; | |
*b = tmp; |