Skip to content

Instantly share code, notes, and snippets.

View maxormo's full-sized avatar

max markin maxormo

View GitHub Profile
@maxormo
maxormo / LongOperation.cs
Created November 12, 2020 06:35
long operation sample
// <copyright file="LongOperation.cs" company="Microsoft">
// Copyright (c) Microsoft. All rights reserved.
// </copyright>
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.MachineLearning.InferenceDeployment.Grains.Interfaces;
using Orleans;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace common
{
public class OperationChain
{
protected readonly Dictionary<string, TaskState> _states;
private TaskState _parentState;
import java.util.ArrayList;
import java.util.List;
public class test {
public static void main(String... args) {
int[][] g = new int[][]{
new int[]{},
new int[]{2, 5, 4},
Bringing a Gun to a Guard Fight
===============================
Uh-oh - you've been cornered by one of Commander Lambdas elite guards! Fortunately, you grabbed a beam weapon from an abandoned guardpost while you were running through the station, so you have a chance to fight your way out. But the beam weapon is potentially dangerous to you as well as to the elite guard: its beams reflect off walls, meaning you'll have to be very careful where you shoot to avoid bouncing a shot toward yourself!
Luckily, the beams can only travel a certain maximum distance before becoming too weak to cause damage. You also know that if a beam hits a corner, it will bounce back in exactly the same direction. And of course, if the beam hits either you or the guard, it will stop immediately (albeit painfully).
Write a function answer(dimensions, your_position, guard_position, distance) that gives an array of 2 integers of the width and height of the room, an array of 2 integers of your x and y coordinates in the room, an array
Free the Bunny Prisoners
========================
You need to free the bunny prisoners before Commander Lambda's space station explodes! Unfortunately, the commander was very careful with her highest-value prisoners - they're all held in separate, maximum-security cells. The cells are opened by putting keys into each console, then pressing the open button on each console simultaneously. When the open button is pressed, each key opens its corresponding lock on the cell. So, the union of the keys in all of the consoles must be all of the keys. The scheme may require multiple copies of one key given to different minions.
The consoles are far enough apart that a separate minion is needed for each one. Fortunately, you have already freed some bunnies to aid you - and even better, you were able to steal the keys while you were working as Commander Lambda's assistant. The problem is, you don't know which keys to use at which consoles. The consoles are programmed to know which keys each minion had, to prevent someo
//Write a function called answer(n) which takes a positive integer as a string
//and returns the minimum number of operations needed to transform the number of pellets to 1.
//The fuel intake control panel can only display a number up to 309 digits long,
//so there won't ever be more pellets than you can express in that many digits.
//For example:
//answer(4) returns 2: 4 -> 2 -> 1
//answer(15) returns 5: 15 -> 16 -> 8 -> 4 -> 2 -> 1
<html>
<head>
<style type="text/css">
body {
max-width: 100ch;
margin-left: 20px;
text-align: justify;
font-family: monospace;
font-size: 14px
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React</title>
<script src="https://fb.me/react-0.14.8.js"></script>
<script src="https://fb.me/react-dom-0.14.8.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
</head>
<body>
@maxormo
maxormo / counter.js
Created March 23, 2016 14:02 — forked from intenter/counter.js
js interview questions
var counter = require('counter.js');
counter.increment();
console.log(counter.value); //prints 1
var counter2 = require('counter.js');
counter2.increment();
console.log(counter2.value); //prints 2
@maxormo
maxormo / 1079.py
Last active December 23, 2015 20:25
import math
from sys import stdin
v = [int(i) for i in stdin.read().split()]
def make_sift():
lens = 15000*15000
res = [True] * lens
sres = []