CMD:
go run main.go R1C4 R1C6 R2C3 R2C7 R3C9 R3C10
then enter the number of seats you want to reserve
This file contains hidden or 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
func hourglassSum(arr [][]int32) int32 { | |
var maxVal int32 = -63 | |
for i, j := 0, 0; i < len(arr) - 2; j++ { | |
tr := arr[i][j] + arr[i][j+1] + arr[i][j+2] | |
mr := arr[i+1][j+1] | |
br := arr[i+2][j] + arr[i+2][j+1] + arr[i+2][j+2] | |
total := tr + mr + br | |
if total > maxVal { | |
maxVal = total | |
} |
This file contains hidden or 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
package merkletree | |
import ( | |
"bytes" | |
"crypto/sha256" | |
"errors" | |
"fmt" | |
) | |
//Content represents the data that is stored and verified by the tree. A type that |
This file contains hidden or 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 <iostream> | |
#include "node.h" | |
#include "nodeValue.h" | |
using namespace std; | |
struct animal: public nodeValue { | |
int age; |
This file contains hidden or 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" | |
#include "stdlib.h" | |
#define M 3 | |
typedef struct _node { | |
int n; /* n < M No. of keys in node will always less than order of B tree */ | |
int keys[M - 1]; /*array of keys*/ | |
struct _node *p[M]; /* (n+1 pointers will be in use) */ | |
} node; |
This file contains hidden or 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" | |
#include "stdlib.h" | |
typedef struct _node { | |
int value; | |
struct _node *next; | |
} node; | |
// Create a new node with the provided value | |
node *new_node(int _value) { |
This file contains hidden or 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
#[macro_use] | |
extern crate lazy_static; | |
use std::collections::HashMap; | |
lazy_static!( | |
static ref MAPPING: HashMap<char, char> = [('}', '{'), (')', '('), (']', '[')] | |
.iter() | |
.cloned() | |
.collect(); | |
); |
This file contains hidden or 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 <vector> | |
#include <math.h> | |
namespace number { | |
bool is_narci(int num) { | |
int num_cp = num; | |
int num_length = num == 1 ? 1 : ceil(log10(num)); | |
int length = num_length; | |
int acc = 0; |
This file contains hidden or 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
# num = 1234 | |
# num_length = Math.log(num, 10).ceil => 4 | |
# base = 10 ** (num_length - 1) => 1000 | |
def is_armstrong(num) | |
if (1..9).include?(num) | |
return true | |
elsif num == 10 | |
return false | |
end |
This file contains hidden or 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
use std::io::{self, Read, Write}; | |
struct StringRW { | |
value: String, | |
buffer: Vec<u8>, | |
} | |
impl StringRW { | |
fn new(value: &str) -> Self { | |
StringRW { |
NewerOlder