Arnab Chakraborty

Arnab Chakraborty

3,768 Articles Published

Articles by Arnab Chakraborty

Page 163 of 377

Merge Two Sorted Lists in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 25-Mar-2026 1K+ Views

Merging two sorted lists is a common programming problem where we combine two ordered sequences into a single sorted sequence. Python provides several approaches including recursion, iteration, and built-in methods like heapq.merge(). For example, if A = [1, 2, 4, 7] and B = [1, 3, 4, 5, 6, 8], the merged result will be [1, 1, 2, 3, 4, 4, 5, 6, 7, 8]. Using Recursion with Linked Lists The recursive approach works by comparing the first elements of both lists and selecting the smaller one ? class ListNode: def ...

Read More

Longest Common Prefix in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 25-Mar-2026 7K+ Views

Finding the longest common prefix among a set of strings is a common programming problem. The longest common prefix is the initial substring that appears at the beginning of all strings in the array. If no common prefix exists, we return an empty string. For example, given the array ["school", "schedule", "scotland"], the longest common prefix is "sc" since it appears at the start of all three strings. Algorithm Approach We start by taking the first string as our reference. Then we iterate through each remaining string, comparing characters one by one. When we find a mismatch, ...

Read More

Roman to Integer in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 25-Mar-2026 37K+ Views

Converting Roman numerals to integers is a common programming problem. Roman numerals use specific symbols with defined values, and some combinations follow subtraction rules. Roman Numeral Values The basic Roman numeral symbols and their integer values are ? Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 Subtraction Rules Some Roman numerals use subtraction instead of addition ? I can be placed before V (5) and X (10) ...

Read More

Two Sum in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 25-Mar-2026 19K+ Views

The Two Sum problem is a classic coding challenge where you find two numbers in an array that add up to a specific target. Given an array of integers and a target sum, return the indices of the two numbers that add up to the target. For example, if the array is [2, 8, 12, 15] and the target is 20, the solution returns indices [1, 2] because 8 + 12 = 20. Algorithm Approach We use a hash map (dictionary) to store each number and its index as we iterate through the array. For each element, ...

Read More

Find the version of the Pandas and its dependencies in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 25-Mar-2026 283 Views

Pandas is a crucial package for data analysis in Python. Different versions may have compatibility issues, so it's important to check your Pandas version and its dependencies. Python provides several methods to retrieve this information. Finding Pandas Version The simplest way to check the Pandas version is using the __version__ attribute ? import pandas as pd print(pd.__version__) 2.1.4 Alternative Methods to Check Version Using pkg_resources import pkg_resources version = pkg_resources.get_distribution("pandas").version print(version) 2.1.4 Using importlib.metadata from importlib.metadata import version print(version('pandas')) ...

Read More

Binary Search (bisect) in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 25-Mar-2026 2K+ Views

The bisect module in Python provides functions for binary search operations on sorted lists. Binary search is an efficient algorithm that finds elements in O(log n) time complexity, making it much faster than linear search for large datasets. We will explore three common binary search operations using the bisect module ? Finding First Occurrence of an Element The bisect_left() function returns the leftmost insertion point for a value in a sorted list. This helps us find the first occurrence of an element ? Syntax bisect.bisect_left(a, x, lo=0, hi=len(a)) Parameters: a - ...

Read More

Anti Clockwise spiral traversal of a binary tree?

Arnab Chakraborty
Arnab Chakraborty
Updated on 18-Mar-2026 364 Views

Here we will see one interesting problem. We have a binary tree and we have to traverse it in an anti-clockwise manner. The traversal alternates between printing levels from right-to-left (starting from the top) and left-to-right (starting from the bottom), creating a spiral-like anti-clockwise pattern. For the binary tree shown below, the anti-clockwise traversal sequence is − 1, 8, 9, 10, 11, 12, 13, 14, 15, 3, 2, 4, 5, 6, 7 Binary Tree — Anti-Clockwise Traversal ...

Read More

What is the difference between a kernel and an operating system?

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Mar-2026 912 Views

The kernel and operating system are closely related but distinct components of a computer system. Understanding their differences is essential for grasping how modern computers manage resources and provide services to users and applications. Operating System An operating system (OS) is a comprehensive collection of software that manages computer hardware resources and acts as an interface between users and the computer hardware. It provides common services for computer programs and serves as the foundation for all other software running on the system. The OS includes various components such as device drivers, system utilities, user interfaces, file systems, ...

Read More

What are the fundamental differences between Windows and Linux?

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Mar-2026 649 Views

Windows and Linux are two of the most widely used operating systems, each with distinct philosophies, architectures, and target audiences. Understanding their fundamental differences helps users choose the right platform for their needs. Windows Windows is a proprietary operating system developed by Microsoft. It evolved from the Disk Operating System (DOS) and has become the most popular desktop operating system worldwide. Windows is designed with user-friendliness in mind, featuring a graphical user interface that requires minimal technical knowledge to operate effectively. Modern Windows versions are standalone operating systems that no longer require DOS as a foundation, though ...

Read More

Local procedure calls in Windows

Arnab Chakraborty
Arnab Chakraborty
Updated on 17-Mar-2026 2K+ Views

The Local Procedure Call (LPC) facility in Windows is a message-passing mechanism designed for communication between two processes on the same machine. LPC is optimized specifically for Windows and serves as an efficient alternative to standard Remote Procedure Call (RPC) mechanisms. Windows uses port objects to establish and maintain connections between processes, similar to the Mach operating system. Types of Ports Windows employs two types of ports for LPC communication: Connection ports − Used for establishing initial connections between client and server processes Communication ports − Used for actual message exchange after the connection is established ...

Read More
Showing 1621–1630 of 3,768 articles
« Prev 1 161 162 163 164 165 377 Next »
Advertisements