Find The Full Path of The Python Interpreter

[toc] Introduction Problem Statement: How to find the full path of the currently running Python interpreter? There are different ways to find the full path of Python interpreters. But first, let’s get the basics out of our way before we unearth the solution to our problem statement. So, what’s a Python Interpreter? This might be … Read more

[Google Interview] The 3 Sum Problem

Company Tags: Google, Adobe, Amazon, Apple, Bloomberg, Facebook, Oracle, Microsoft, Tesla Problem Statement Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Note: that the solution set must not contain duplicate triplets. … Read more

[Google Interview] Detect Capital

[toc] Company Tag: Google Problem Formulation We define the usage of capitals in a word to be right when one of the following cases holds: Rule 1: All letters in this word are capitals, like “USA”. Rule 2: All letters in this word are not capitals, like “welcome”. Rule 3: Only the first letter in … Read more

[Google Interview] Shuffle the Array

[toc] Company Tags: Google, Adobe, Apple, Bloomberg, Microsoft Problem Description Given the array nums consisting of 2n elements in the form [x1, x2,…,xn, y1, y2,…, yn]. Return the array in the form [x1, y1, x2, y2,…, xn, yn]. Constraints: 1 <= n <= 500 nums.length == 2n 1 <= nums[i] <= 10^3 Examples Let’s have … Read more

[Google Interview] License Key Formatting

[toc] Company tags: Google, Capital One Problem Formulation You are given a license key represented as a string s that consists of only alphanumeric characters and dashes. The string is separated into n + 1 groups by n dashes. You are also given an integer k. We want to reformat the string s such that … Read more

How To Create a Two Dimensional Array in Python?

[toc] Introduction Today we can see 2D arrays used everywhere. As simple examples – chessboard, eggs arranged in a rectangular egg-holder are 2D arrays. In the world of computers, we use 2D arrays everywhere. 2D arrays are used in Image processing, Surveys, Speech Processing, Geoscience, Tables, Databases, Graphs, etc.  What is a Dimension in an … Read more

How to Fix UnicodeDecodeError when Reading CSV file in Pandas with Python?

[toc] Introduction In general, encoding means using a specific code for the letters, symbols, and numbers. Numerous encoding standards that are used for encoding a Unicode character. The most common ones are utf-8, utf-16, ISO-8859-1, latin, etc. For example, the character $ corresponds to U+0024 in utf-8 standard and the same corresponds to U+0024 in … Read more

How to Log a Python Error with Debug Information?

[toc] Generally, logging is an extremely valuable tool in a software developer’s toolbox. Logging helps to assist you with the flow of a program and find situations that you probably would not have considered while coding. By logging useful data and information, you can troubleshoot the errors effectively as well as utilize the information to … Read more

[Interview Question] How to Check a Valid Palindrome?

[toc] Company tags: Apple, Amazon, Bloomberg, Facebook, Microsoft, Oracle This is one of the most commonly occurred questions in numerous interviews and you should be absolutely ready to solve this question in a flash as soon as you see this in your interview. Hence, let’s dive into the problem and solution to this interview question. … Read more