Posts

Amazon Interview (on-campus - Software Dev Engineer) with answers/solutions

Round 0 (online): There was online test for 300 students. 25 were selected for interviews. There were 4 back-to-back rounds on the same day. Round 1: 1. Given 1 billion integers. Find 100 maximum integers. Memory available is insufficient to store 1 billion integers. Solution: Use a min heap of max size 100 (remember, heap can be implemented using array as it is a full binary tree). Compare every integer with value at 'root' of heap. if element>root_value remove root from heap. insert element in heap. Do this for all integers. 2. Given array of N integers ranging from 0 to N-1. Output maximum repeating integer. Use only O(1) memory.

Interview with ACRush (Tiancheng Lou), the coding sensation!

Image
25-year-old floor Sky City has "the first person of Chinese college students in computer programming" in the title, is also students who participated in the contest King called "floor leader." His legend has inspired many young students: from 2001 began to participate in computer programming competitions and even won the national first prize; 2004 selected for the National Team, the same year and was recommended for admission to Tsinghua IOI gold; began in 2008 Theoretical Computer Center first Asian Turing Award winner Academician Yao PhD; twice in 2007 and 2009 led to participate in ACM / ICPC World Finals and finished second.  "Programmer" recently interviewed Wizards floor programming Amagi, let him share with us his legendary programming competitions road. Reporter: please talk about your childhood experiences.  Childhood who, what things affect you the most? F, Tin City: a child, I am more playful, do not like to learn how.  Later in the 8 year...

Segment Trees, Tutorial, C++ Code and Applications

Image
A segment tree is a heap-like data structure that can be used for making update/query operations upon array intervals in logarithmical time. We define the segment tree for the interval  [i, j]  in the following recursive manner: the first node will hold the information for the interval  [i, j] if i<j the left and right son will hold the information for the intervals  [i, (i+j)/2]  and  [(i+j)/2+1, j] Notice that the height of a segment tree for an interval with  N  elements is  [logN] + 1 . Here is how a segment tree for the interval  [0, 9]  would look like:  Code for creating a segment tree recursively: #include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; typedef struct segmentTreeNode* Node; struct segmentTreeNode { int low; int high; Node left; Node right; } segmentTreeNode; Node createSegmentTree(int low, int high); int main() {   ...

Apache in Ubuntu: Changing location of www directory.

Hello there! I was trying to install drupal to my computer, so that I can play with its features. For your information, I am using Lubuntu 13.10 (a variant of ubuntu). For installing drupal, I needed to install LAMP on my computer, which I installed using apt-get as: sudo apt-get install lamp-server^ (detailed instructions:  http://www.howtogeek.com/howto/42480/ ) Now, after installing LAMP,

Making money from internet, the most reliable ways!

Image
What you need: A computer and a working internet connection. Have a will to earn, a bit of expertise and some free time? Well, all you need to have is an Internet connection. Here we bring to you a few ways how you can earn some money on the Internet in the comfort of your home. Self publish books If you love writing and want to get a book published, Amazon offers a free service called Kindle Direct Publishing. The service allows anyone to self publish books on the Kindle (electronic) bookstore and earn royalties from sales. There are two plans you can choose from- the 35 per cent royalty works across any book sold in any country, while the 70 per cent royalty plan works if you sell in a few select countries. Indian authors can choose to set prices specifically for the Indian bookstore and receive royalty payments in Indian currency as well. Make and sell your apps With so many smartphones and tablets, app development can be a very lucrative business. You can learn about devel...

Roadies X Winner is Palak Johal!!

Image
Palak Johal, claimed the title of 10th season of famous MTV reality show Roadies, Battle For Glory. Palak, who proved himself the strongest contestant, defeated 15 contestants  and took home a cheque of Rs 4,50,000 and a Hero bike. The other Hero Roadies X Contestants of the finale were Raman Deep, Mohit and Anirudh. Palak- Winner of Roadies X The final  episode of Roadies X began with all the eliminated Roadies entering the location where they clashed with the final four. These four were the finalites: The two boys got eliminated in the rope task. So the ultimate battle was between Ramandeep and Palak. Too bad, isn't it.. most of us wanted Mohit or Anirudh to claim the title. So, the final battle concluded to between Ramandeep and Palak! And finally, Palak Claimed the title of Roadies X, battle for glory !!! Like always Raghu Ram, his twin brother Rajiv Laxman and Rannvijay were the judges. How did you like the 10th s...

One evening story, small things

Image
Yet another important chapter of life is made of small things that we, sometimes, ignore. Another day, a holiday, it was around 4 in the evening. I was preparing to take bath, and while going towards the bathroom, I decided to take a visit to the 'popular' Pangay's room. He was banging his head with his computer screen, trying to find some software on the internet, which I doubt he could find in one life (Thank God he knows how to work on a computer). Going by the brand, he owns a Dell-Pavillion-'some model', with a core i3 inside, but his computer seemed to be beaten by an old pentium. Anyway, it was not his computer's fault, sometimes it depend on who works on it.