Skip to main content

Posts

Showing posts from 2017

Coin Flipping Puzzle: Interview Question

Golu has 100 identical coins (with head side and tail side) which he wants to donate to someone. There are many people who are aiming to get this collection of 100 coins. So Golu created a puzzle using all 100 coins and declared that the one who will solve his puzzle will get all the coins. You desperately need money so solving the puzzle is only option you have. The Problem goes like this: All 100 coins are laying flat on a table. 80 of them are heads up and remaining 20 are tails up. You can’t feel, see or in any other way find out which side is up. Split the coins into two piles(sets) such that there are the same number of tails in each pile. [Baby Hint]: If number of coins in first pile is n then other pile will have 100-n coins. First try yourself before peeking into the solution below. 

10 basic git commands you must know

If you work on software development project then you might have already used git for version control. If you haven't used git yet then it's high time you should learn and start using this. Following are the 10 git commands you must know while getting started with git. 1.  git init :  It initializes the git repository. Running this command creates a directory(. git ) inside the current directory which contains git configuration and other repository data.  See below image how there was no git repository initially and after running git init , an empty git repository is initialized as we can see the .git directory gets created. 2. git status : It shows the current status of the repository by showing the difference between index file and the current HEAD commit. It shows the untracked files and files which are added to staging area but not yet committed. You can use different options with git status .  Using -s option gives the output in short format. Option -v or --