I hereby claim:
- I am isaiah-perumalla on github.
- I am isaiah_p (https://keybase.io/isaiah_p) on keybase.
- I have a public key ASB2WZfQUWqLR4Aci20nORmizByne74eM-xm_t-EX9diowo
To claim this, I am signing this object:
VARIABLES counter, pc | |
(* define statement *) | |
AllDone == \A t \in Threads : pc[t] = "Done" | |
Correct == AllDone => counter = ThreadCount | |
VARIABLE localCounter | |
vars == << counter, pc, localCounter >> |
--------------------------- MODULE concurrent_map --------------------------- | |
EXTENDS TLC, Integers, FiniteSets, Sequences | |
ReaderCount == 2 | |
Readers == 1..ReaderCount | |
I hereby claim:
To claim this, I am signing this object:
package com.company; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
public class Main { | |
public static final int INF = Integer.MAX_VALUE; | |
public static void main(String[] args) { |
package practice; | |
import java.util.ArrayDeque; | |
import java.util.ArrayList; | |
import java.util.Queue; | |
import practice.BinarySearchTree.Node; | |
public class BSTPrint { | |
def calc_avg(items): | |
if not items: | |
return 0 | |
total = sum(items) | |
return float(total)/len(items) | |
def std_deviation(items): | |
if not items: return 0 | |
mean = calc_avg(items) |
//function return all subset of a list | |
sset: {[xs] (enlist ()) {x, (y,) each x }/ xs} | |
//or using the map each right /: | |
sset: {[xs] (enlist ()) {x, y ,/: x }/ xs} | |
//q)sset (1; 2; 3;`a) | |
() | |
,1 | |
,2 | |
2 1 |
I hereby claim:
To claim this, I am signing this object:
def solution(N, A, B, C): | |
edges = [(C[i],A[i],B[i]) for i in xrange(len(A))] | |
edges.sort(key=lambda e: e[0]) | |
maxLenAt = [0]*N | |
costAt = [0]*N | |
def updatePath(u,costu,lenu, v,costv, lenv, cost): | |
if costu < cost and lenu+1 > lenv: | |
maxLenAt[v] = lenu+1 | |
costAt[v] = cost |
def water_collected(A): | |
sortedHeights = [(x,i) for i,x in enumerate(A)] | |
sortedHeights.sort(key=lambda v: v[0]*-1) #sort in decreasing order | |
leftIdx = rightIdx = sortedHeights[0][1] | |
waterLevel = 0 | |
for i in xrange(1,len(A)): | |
x,idx = sortedHeights[i] | |
if idx > rightIdx: | |
water = (idx-rightIdx-1)*x |