snippets

Snippet code, help with coding code samples, solution to interview questions in Python Java, PHP etc.

How to install Numpy (Windows and Linux)

Getting Started with Python NumPy arrays

NumPy is an open-source Python library that handles multidimensional arrays and matrices with a huge library of mathematical functions to manipulate arrays. If you are working with image processing, voice processing, or machine learning, Learning NumPy should greatly improve your research and development. NumPy makes it easy to work with data in the formats required for machine learning, such …

How to install Numpy (Windows and Linux) Read More »

How to use equal and not equal operators in Python

How to use equal and not equal operator in Python

Learn about One of the most important Python operators: Python == and Python !=. These comparison operators can be used with integers, strings, lists, dictionaries, and anything you can think of. These operators can compare the integer value with the float value; for example 1 == 1.0, this statement returns True because technically these two …

How to use equal and not equal operators in Python Read More »

How to read CSV file in pandas: An advance guide

Read CSV files in Panda Complete Guide(3)

CSV (Comma Separated Values)  files are one of the most used files for storing data, and of course, for analyzing these data, and there are multiple ways you can read CSV files in Python. Python’s Pandas is out there to simplify this journey. Also read: Getting started with NumPy Let’s get started with this helpful …

How to read CSV file in pandas: An advance guide Read More »

How to Make a Game in C++ Visual Studio: Tic Tac Toe

The visual studio is an IDE (Integrated Development Environment) mainly used to create various applications and chiefly gaming applications. This software provides its user with a comfortable environment to produce any game or application.  It supports some built-in high-level programming languages like C, C++, and C#. Moreover, it also sustains other languages like python and …

How to Make a Game in C++ Visual Studio: Tic Tac Toe Read More »

Leetcode 56. Merge Intervals

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input. Leetcode 56. Merge Intervals One of the medium-hard problems found on Leet Code is known as “Merge Intervals.” This challenge gives us a list of lists of …

Leetcode 56. Merge Intervals Read More »

Leetcode 146. LRU Cache: Multiple Solutions in Python Code

“Design LRU cache” is a very typical interview problem asked in FAANG. This question shows the design capability of the candidate and how he selects the datatype while programming. Caches are an integral component of any computing system. These are tiny containers that store data fragments to make them accessible easily thus, reducing computing time.  …

Leetcode 146. LRU Cache: Multiple Solutions in Python Code Read More »

Leetcode: Count Good Nodes in Binary Tree in Python

Count good nodes in a binary tree, according to LeatCode this is Microsoft’s most asked interview question of 2021 so far.  I think it’s a pretty good problem to understand. A lot of basic Tree fundamental knowledge can be gained from this problem.  So we’re given the root of a binary tree that is going …

Leetcode: Count Good Nodes in Binary Tree in Python Read More »

What is the best way to sort Python dictionary by Value

python sort dictionary by value

Data structure dictionary in Python before 3.7 version has no particular order, which makes the process of sorting a tedious job for most beginners Sorting data is not a new thing for us. We perform this operation as we buy products online, set official and unofficial appointments, or simply stack our wearables in a wardrobe. …

What is the best way to sort Python dictionary by Value Read More »

Leetcode 1: Two Sum problem – Multiple Solutions in Python

Two Sum problem is considered easy and is frequently asked in Amazon phone interviews. We will see how we can start with a brute force solution and try to improve the code by introducing more data structures. Problem Statement: Given an array of integers nums and an integer target return indices of the two numbers …

Leetcode 1: Two Sum problem – Multiple Solutions in Python Read More »

Generate Random Number and String in Python

Generate Random Number and String in Python

Creating random number or string in Python is way more easier then you think. random module can be used to generate random numbers in Python. Combining String module with random module, we can generate random strings in Python. I have tried these two modules myself in multiple programs to generate random numbers and strings. we …

Generate Random Number and String in Python Read More »

Top 15 Best Bootstrap Radio Buttons Purely in CSS

15 best bootstrap radio buttons purely in CSS

Radio buttons serve many purposes, the main use is associated with basic choices that are not related. This suggests that the client can just select one option or an alternative. Skilled designers continuously propose an indirect strategy that involves a powerful linger. In other words, it is advised to stick with the circular structure. Considering …

Top 15 Best Bootstrap Radio Buttons Purely in CSS Read More »

Writing your first python CGI ajax script

Python-Ajax-JSON-Request-Example

This post will demonstrate how to write a Python-CGI script using Ajax. Install python and set the environment path. Create a directory for your project and create run.bat with “python-m CGIHTTPServer”. In cgi-bin directory create a file time.py The best part is that you don’t need Apache server to run this demo so you dont …

Writing your first python CGI ajax script Read More »