Solutions to programming interview questions at some of the top companies in the world: cppcodingzen.com

*Bit manipulation and bitwise operators are some of the hardest problems in programming interviews. This post discusses an interesting bit manipulation problem. The problem was asked by Salesforce.*

Given an array, find the maximum AND value generated by any pair of element from the array.

Examples:

Input : arr[] = {4, 8, 12, 16}

Output : Maximum AND value = 8 Input : arr[] = {4, 8, 16, 2}

Output : Maximum AND value = 0

(Recall that `&`

is a bitwise AND operator in C++).

Recall the truth table of the logical AND operator

The AND of two bits…

*Data structure manipulation comes up pretty frequently in programming interview questions. This post discusses manipulating a linked list to design stacks. The problem was asked in a programming interview by Microsoft.*

*This post also adds more robustness to the implementation by using C++ language support (iterators and templates). A command over standard language constructs makes your interview stand out, and gives you an extra edge in the hiring process!*

Implement three stacks using one Linked List.

The basic algorithm should be easy after a moment’s thought. Here is the diagram that explains it!

*Some of the most interesting programming interview questions are based on arrays. The inputs of these interview questions are simple arrays of integers or floating point numbers. Your task, as a candidate, is to perform some operations on these numbers (maybe find the most frequently occuring one, or the largest sum among the arrays; or, find the most optimal floating point adjustments to the array, as today’s problem demands).*

*Most array based problems are easy to state and understand. It is also extremely easy and quick to come up with and code the simplest, least efficient solution to these problems…*

Here is the copy of Satoshi’s famous White Paper on bitcoin: https://cppcodingzen.com/bitcoin.pdf. Please read, understand, distribute, upload this paper on your website if you care about open and free internet.

*Graph theory is immensely popular among interviewers in a variety of industries. Here is an interview problem on Graph Theory asked at Jane Street, a FinTech firm.*

*Feel free to take a look at some of our **previous** **Graph** **Theory** problems and their solutions.*

Suppose you are given a table of currency exchange rates, represented as a 2D array. …

*Dynamic programming is a favorite of many interviewers during programming interviews — it tests your problem formulation strategy, good use of recursive algorithms and data structures (mostly multi-dimensional arrays or hashtables), and also tests your ability to reason about computational complexity of a recursive algorithm with memoization.*

*Let’s work our way through a Dynamic Programming problem in an unexpected place. The problem was asked by QuantCast. Feel free to look through **other** **posts** for most instances of Dynamic Programming.*

You are presented with an array representing a Boolean expression. The elements are of two kinds:

Determine the number of ways…

*We are taking a break from data science, probability and statistics; and revisiting programming exercises. The problem we are going to tackle in this post comes from graph theory and efficient graph traversal. Graph theory is favorite of many interviewers, because formulating a problem in graph theory terms involves a lot of insight, and really tests a candidate’s skills. Most algorithms fit a few tens of lines of code, and whiteboard coding is a quick and easy way of testing those skills.*

*Read along for a fun application of graph traversal. The problem was asked by Uber. …*

*In **previous post**, we saw how to calculate expected values and conditional expectations of random variables. In this post, we are going to solve a tricky problem involving more expectations and correlations.* *The problem was asked by Robinhood.*

*Recall that some of the hardest data science interview questions involve conditional expectations. Even among them, correlations are the hardest to calculate! Read on to find out how to efficiently compute them.*

Say you roll a fair dice 5 times. Let X be the number of times a 2 was rolled, and Y the number of times a 3 was rolled. …

*Happy 2021 everyone! This year, we are bringing more solutions to common interview questions to you.*

*First up, we are continuing with a couple of data science questions, especially on expectations. Expected value of random variables (and their correlations) are some of the most common, and some of the hardest interview questions to crack. Follow along to see some techniques on solving them.*

*(Feel free to browse a **few** **other** posts on data science interview questions)*

Alice and Bob are choosing their top 3 shows from a list of 50 shows. Assume that they choose independently of one another. Being…

*We are continuing our series on cracking Data Science interviews. So far, we have worked out a **few** **examples** on Maximum Likelihood Estimator (MLE). In this short post, we are going to solve a few problems involving Uniform Distribution. Uniform Distribution is yet another favorite of many interviewers, and nailing any problems involving Uniform *Distribution really makes your candidacy stand out 🙂

A uniform distributionover the bounds a and bhas the following probability density function: