Alias Unable to install Homebrew Unable to install Homebrew with this? ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" What’s happened -e:70: warning: Insecure world writable dir /usr/local/bin

app Interview Practice Extra 07 - Universal Value Binary Tree Question Design an algorithm to verify that a tree is a universal value binary tree. Universal value binary tree means all value in that tree is the same. Solution There is two approach

5 cent Interview Practice Extra 06 - Vending Machine Question This is an actual question I encountered in an Amazon phone interview in November 2013. You are going to design the money changing algorithm for a vending machine. That is, after any

binary Interview Practice 28 - Counting One in Binary Expression Question Given a number, find the number of 1 in the number’s binary expression. For example, binary express of 10 is 1010. So the number of 1 in it is 2. Solution

cha Interview Practice 26 - String Right-rotation Question Write a program to right-rotate a string by m characters. Right-rotating a string means moving m characters at the left of string to the right. Is it required the time complexity is

interview Interview Practice 24 - Reverse a Linked List Question Reverse a linked list. Sample node structure class Node: value = None next = None def init(self, value, next_node=None): self.value = value self.next = next_node # reverse the linked list and

how Interview Practice 22 - Card Guessing Question Consider there are 4 blue and 4 red cards. Host gets 2 cards randomly, no one knows what cards they are. Then he places 2 random cards at the forehead of each

determine Interview Pizzle 1 - Find the Heavier Marble Question You have 9 marbles. 8 marbles weigh 1 ounce each, & one marble weighs 1.5 ounces. You are unable to determine which is the heavier marble by looking at them. You

cha Interview Practice 20 - Convert String to Integer Question Convert the inputted string to an integer. For example, “345” will output 345. Solution Though it looks simple, in fact it is pretty tricky. First we need to make the concept clear.

circle Interview Practice 18 - Last Surviving Number in Loop Consider Consider there is a list containing N numbers, and which formed a ring. That is, item n+1 is item 1. Construct an algorithm such that it traverses through the ring, and

app Interview Practice Extra 03 - Verify Binary Tree with Same Value Question Verify whether all nodes have the same value in a binary tree. Solution We can traverse the tree with our usual way, like depth-first or breadth-first algorithm. Then pass a value, probably

extra Interview Practice Extra 02 - Duplicates in List Question Write an algorithm to remove duplicated node from a linked list. Solution There are many ways to do it. For the first one, as the simplest one, we could use 2 loops

extra Interview Practice Extra 01 - Find Loop in Linked List Question Validate a linked list whether there is a loop in it. That is, there is a node in a linked list with the next pointer pointing to a node ahead in the

app Interview Practice 16 - Print Binary Tree Layer-by-layer Question Print a binary tree layer-by-layer from top to bottom, and from left to right for each layer. Solution Yes, it’s a simple task. We can use breadth-first search, and which means

app Interview Practice 15 - Mirror Image of Binary Tree Question Construct 2 algorithms to make mirror image of any binary tree inputs, one of them using recursive method, another one using looping method. Mirror image means a binary tree that is the

find Interview Practice 14 - Find Integer With Wanted Sum Question Given a sorted integer list and an integer, find two integer in the list such that the sum of the two integers equals the given integer. It is required that the time

cha Interview Practice 13 - Last Kth Node of Linked List Question Given a linked list, find the Kth last node in a linked list. The last 0th node is the tail node in the linked list. Solution Easy task. Construct 2 pointers: P1

binary Interview Practice 11 - Greatest Distance Between Two Nodes in Binary Tree Question Get the greatest distance between two nodes in a binary tree. Assume links between nodes are bidirectional. Distance is defined as the amount of nodes connected along the path linked two nodes.

app Interview Practice 10 - Reverse Sentence Question Simple task, reverse words in a sentence. Solution In Python, this can be simple because of the build-in functions. We can just split the sentence by spaces, reverse the list, and join

binary Interview Practice 09 - Verify Post-order Sequence of BST Question Construct an algorithm to verify if a set of numbers is the post-order search result of a binary search tree. Let the figure at the right hand side as an example, the

code Interview Practice 07 - Determine if Two Linked Lists Intersect Question Given 2 linked list head pointers, determine whether they intersect at some point. Solution First of all, linked list can have loop or not, and this gives 3 possible situations. For the

binary Interview Practice 01 - Convert Binary Tree into Doubly Linked List Question Convert binary search tree into doubly linked list. It’s required not to create any new node, but only turning pointers. Solution The following shows the concept of this question. 8 / 6

app Save Terminal from Process Completed in Mac OSX What’s happening One day, when I opened up terminal as usual, it showed [Process completed] and just terminated. I could not type any thing, run any scripts and work on my project.

apache External directory in Xampp (Apache) For both server and website developing, I usually use Xampp’s Apache to create a localhost server. However, I hate to put my important files in the htdocs inside Apache. Instead I would