Sunday, January 31, 2016

Elementary OS with ASUS zenbook

So I recently bought a Asus Zenbook UX305LA FC004T. It's in the same price range of a macbook air but with higher specs. Lookwise it looks like a macbook air copy and comes with a Windows 10 pre-installed.

But for people like who need a linux distro, elementary OS is the upcoming OS who is taking the world by a storm. You will defintely like its UI and its a good combination with Asus Zenbook.

My reviews with the combinations
1. Battery life is about 8hrs with full charge and moderate use, should be more for windows
2. Speakers are very low volume there are few hacks suggested for this.
3. Screen is good and its pretty lighweight and sturdy, my friend sat on it accidentally , still all is good.

Compared with macbook air which comes in the same price range I don't know how this device would fare, but given the extra 128 gb and extra 4gigs ram this seems the better choice.


Few things that I did to install Elementary OS

After dual booting my PC with Freya, I did the following
sudo apt-get install ubuntu-restricted-extras
Run a sudo apt-get update before and enable the canonical partners repository.

Following tools are a must

  • Synapse, a semantic serach engine it makes life beautiful when using linux 
  • Elementary Tweaks
  • Glipper, saves the content of your copyboard
  • KeePassX, saves the mundane password and the touble of filling them

Monday, January 25, 2016

Becoming better with vim

These are the things that I learn while on my vim journey

Here is good list of articles that you should read, to start with this is an excellent cheat sheet for vim

A Introductory cheatsheet, do this before going to another

http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html

Then these articles are helpful

Moolenar : Good Vim Habits

ctags, is a very good tool for navigating through big projects.

Here is another very good blog about learning vim
http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/

definitely do the above before moving on.

Next steps after learning these shortcuts is having a good .vimrc file, which is basically a configuration file for your vim( stored in the HOME directory). You can search for popular .vimrc on the net. I'll list a few that I find good

Plugins , now as suggested by a friend I started using vundle , which is a vim plugin manager.
 


Monday, November 23, 2015

Minimum No. of Jumps

Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Your goal is to reach the last index in the minimum number of jumps.
Example :
Given array A = [2,3,1,1,4]
The minimum number of jumps to reach the last index is 2. (Jump 1 step from index 0 to 1, then 3 steps to the last index.)
If it is not possible to reach the end index, return -1.

 Follow this link to read a O(n^2) solution GeeksforGeeks: Minimum number of jumps

Read my O(n) solution below

Sunday, October 11, 2015

Maximum Product Subarray

One of the standard dp problems, the approach given below is similar to kadane algorithm for maximum subarray sum problem. The code given below fails when negative output is the max possible. For example the input

Input : -4


Comments are welcome.

Monday, August 31, 2015

Preparing for the Coding Interview

Here are a few things that I did while preparing for my placements and a few things that I think I should have done.

This post is written with the plan that you have max of 6 months left before the D-Day, for people in the their 2nd or 3rd years there is a variety of things that would further enhance their chances of being placed.

<-------------------------- 6 Months -------------------------------->
www.geeksforgeeks.org    This is a very big repository of coding interview questions and preparations material. Usually one would require about 6 months to go through the whole material.

<--------------------------- 4 - 5 Months --------------------->

After having read the standard algorithms and Data Structures, its time to gain some coding experience

www.interviewbit.com This site is very good for coders with not much experience, you will have revision of concepts and get practice at the same time. It provides a gaming level sort of UI to make it interesting, which a growing community.

www.leetcode.com This is another site is popular among coders for interview preparation, but many questions between interviewbit and this overlaps so do one of them. InterviewBit has more structure and organization for preparation.

<------------------------------1-2 Months ---------------------------->

Hopefully above level of preparation would be sufficient for clearing hte coding rounds and you are now shortlisted your dream companies. So brush up the topics on your resume and prepare for the specific domains like Networks, OS .

Some important topics to prepare for :
1. Linked List
2. Stacks and Queues
3. Dynamic Programming ( geeksforgeeks has an extensive collection)
4. Greedy
5. Backtracking 
6. Graph Theory ( dfs and bfs will do for most except google,fb ) 


Comments and suggestions are welcome . 




Sunday, December 21, 2014

Getting started with Python API for Facebook

Install the repository with

sudo pip install facebook-sdk

Here is a sample program to print the name of your friends 


To get the oauth_access_token follow this link Graph API Explorer


See the following the snippet for printing posts with some specific substring in them. This way we can complete the hack of posting multiple comments on similar posts



I found another python libray, which seems more easier to use than this one. visit that Facepy

Tuesday, December 16, 2014

SPOJ PRATA


The problem : www.spoj.com/problems/PRATA/

Solution: There are many solutions one can use binary search which is straight forward if you understand the concept of binary search . Use the link to find a binary search based implementation

http://spoj-solutions.blogspot.in/2014/10/prata-roti-prata.html

I used a min-heap based solution. The algorithm is to find the the cook who will next become free and assign him a prata, as simple as that.

My solution is O(p*L) which got accepted. You can find the code through following link
https://github.com/kanirudh/spoj/blob/master/prata.cpp

Comment below in case of queries.