[Google Interview] The Two Sum Problem

[toc] ?️ Company Tags: Google, Facebook, Amazon Are you gearing up for your coding interview? If your answer is yes, then here’s a very important and commonly asked interview question for you. Numerous programmers have claimed that they came across this interview question. Hence, there is a high probability that you might come across it … Read more

How to Get the Row with Minimal Variance in NumPy

You may have read about the β€˜V’s in Big Data: Volume, Velocity, Variety, Veracity, Value, Volatility. Variance is yet another important β€˜V’ (it measures Volatility of a data set). In practice, variance is an important measure with important application domains in financial services, weather forecasting, and image processing. Variance measures how much the data spreads … Read more

How to Return Dictionary Keys as a List in Python?

Short answer: use the expression list(dict.keys()). Problem Formulation Given a dictionary that maps keys to values. Return the keys as a list. For example: Given dictionary {‘Alice’: 18, ‘Bob’, 21, ‘Carl’: 24} Return the keys as a list [‘Alice’, ‘Bob’, ‘Carl’] Solution The dict.keys() method returns a list of all keys in Python 2. The … Read more

How to Concatenate Two NumPy Arrays?

Problem Formulation Given two NumPy arrays a and b. How to concatenate both? Method 1: np.concatenate() NumPy’s concatenate() method joins a sequence of arrays along an existing axis. The first couple of comma-separated array arguments are joined. If you use the axis argument, you can specify along which axis the arrays should be joined. For … Read more

[Interview Question] Reverse A Linked List

[toc] ?️ Company Tags: As reported by numerous programmers across the globe, this question has been asked in coding interviews/rounds by companies like- Amazon Accolite Adobe Cisco Cognizant Goldman Sachs VMWare So, if you are preparing for your upcoming coding interview, then you might well come across this question in your coding round. Can you … Read more

Python Not Operator

Python’s not operator returns True if the single operand evaluates to False, and returns False if it evaluates to True. Thus, it logically negates the implicit or explicit Boolean value of the operand. As you read through the article, you can also watch my video for supporting explanations: Python Not Operator on Boolean You can … Read more

Reverse A Linked List In Python

#Approach 1: Iterative Approach to Reverse Linked List Test Cases: # Example 1 linked_list = Solution() linked_list.push(5) linked_list.push(4) linked_list.push(3) linked_list.push(2) linked_list.push(1) Output: Given linked list 1 2 3 4 5 Reversed linked list 5 4 3 2 1 # Example 2 linked_list = Solution() linked_list.push(5) linked_list.push(4) linked_list.push(3) linked_list.push(2) linked_list.push(1) Output: Given linked list 1 2 … Read more