All views expressed on my twitter are completely mine and have nothing to do with my employment/employer.
Note : This content might change over time. Feel free to look the [history and edits] (https://gist.github.com/dotslash/459ca48435742d9eb724d3b5ea040f63/revisions) of this doc
def hanoi(n, fr, to, buf): | |
if (n == 0): | |
return | |
#print "deb", 'l', n, fr, to, buf | |
hanoi(n-1, fr, buf, to) | |
#print "deb", 'r', n, fr, to, buf | |
print "{} {}->{}".format(n, fr, to) | |
hanoi(n-1, buf, to, fr) | |
def hanoi_iter(n, fr, to, buf): |
I hereby claim:
- I am dotslash on github.
- I am yesteapea (https://keybase.io/yesteapea) on keybase.
- I have a public key whose fingerprint is 178F E423 0A4A 1F23 8504 0E16 992C C2CD 1B3E 2324
To claim this, I am signing this object:
--"9e4c3550b2961d085916ecdead255cde6b450f6b" | |
local ret = KEYS[1] | |
local limit = 100 | |
while limit ~= 0 do | |
local pres = redis.pcall("GET", ret) | |
if pres == nil or type(pres) == "boolean" then return ret end | |
ret = pres | |
limit = limit - 1 | |
end | |
return ret |
In order to use segtree class defined above, you will need to create a datatype(a struct most likely), which will implement the function merge(). It can also additionally implement split, if you need to define the split operation. | |
A sample is shown as "struct segtree_node" in the code above. | |
The segtree has to be instantiated with this defined data type. For example,as | |
segtree<segtree_node> s; | |
You have to first call the init function of the class, which will take | |
int n=number of elements in your array, | |
node[] = your inital array, | |
identity = an element such that merge(y,identity) = merge(identity,y) = y for all y's. |
package reuse; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.StringTokenizer; | |
final class IO{ | |
//Standard IO | |
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));; |
####Waiting for a trigger I was super super active on fb. I could not resist my self from not sharing anything remotely interesting. I like to poke others on their posts and find out flaws in the what others write. It used to take 3-4 hours of my day easily. I used to hate this. I always wanted to get out of facebook, but could not because there is no push and was a little scared of losing out many contacts.
####Here comes the trigger My question on FB forums on what happened
On 27th august while playing around with FB's official android app, I clicked something and all my work contacts (includes >mailing lists, CEO, CTO and a never ending list of contacts in my mail) got invites to facebook from me.
>I thought this was over. But again on 12 Sept without any action from my side the same happened again. This time facebook sent reminders to the same contacts to connect with me.
I hereby claim:
- I am dotslash on github.
- I am yesteapea (https://keybase.io/yesteapea) on keybase.
- I have a public key whose fingerprint is 62A7 9F1A 0085 D199 D692 0854 99D4 F20A 50CA 42C4
To claim this, I am signing this object:
#include <cstring> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <climits> | |
#include <cmath> | |
#include <string> | |
#include <iostream> | |
#include <algorithm> |