Given two strings which represent different version releases of a software, print -1, 1 or 0 depending on the order of the releases. If version1 was released after version2 print 1, If version1 was released before version2 print -1, otherwise print 0. Assumptions granted : Strings may only contain digits and the '.'(dot) character … Continue reading Compare Versions
A clean and concise guide to Data Science.
Kaggle is a Data Science community where thousands of Data Scientists compete to solve complex data problems.
In this article we are going to see how to go through a Kaggle competition step by step.
The contest explored here is the San Francisco Crime Classification contest. The goal is to classify a crime occurrence knowing the time and place it happened.
View original post 916 more words
Question : Write a program that takes a 64-bit word, output the reverse of that word. I would urge you to minimize the window and try to solve this question on your own first. Method - 1 Brute Force Solution Simply apply the bitswap method we used earlier on all the extreme bits. Time … Continue reading 3. Reverse Bits
What is the Standard Template Library(STL) ? The Standard Template Library (STL) is a software library for the C++ programming language. It provides four components called containers, iterators, algorithms and functional. STL library lies in the std namespace. Why do we need to use the STL? 1. There is no use in inventing a wheel that has been in presence for … Continue reading Standard Template Library : An Introduction
A much awaited day, a long lost dream, finally comes to life with codenmath.com, a wish I had for 9 years now; has awaken only to become a reality. At last a place where I can share all my knowledge, of whatever I have. A belly that has been so full of words will finally … Continue reading Numbers and recipes at Codenmath.com
Question : Given a number and 2 indices return the number after swapping bits present at those indices. Method-1 : Brute-Force We can swap bits by following the given steps :- 1. Using bitmasks to extract the ith and jth bits. 2. Save the extracted bits to some local variables. 3. Write the jth bit to … Continue reading 2. Swap bits
Question : Compute the parity of a 64-bit word. Parity of a number refers to whether it contains an odd or an even number of 1's in its binary representation. The parity of a number is 1 if it contains odd number of 1's, else 0. Method-1 : Brute Force We can iteratively test the … Continue reading 1. Parity of a Word