Merge Two Sorted Arrays in-place

Problem Two integer arrays nums1 and nums2 are sorted in non-decreasing order, and two integers …

Replace Item in Python List

There are many ways to replace item or items from a Python list. We can use indexing, list comprehe…

Python Average

Unfortunately, Python does not provide a standard built-in function to calculate the average of a l…

Python Compare Strings

There are 6 comparison operators in Python that return True or False by comparing two operands. And…

Python TypeError: ‘function’ object is not subscriptable Solution

In Python, to call a function, we use the function name followed by parenthesis (), and pass the ar…

Python Error: TypeError: 'tuple' object is not callable Solution

A tuple is an immutable data structure in Python. It is very similar to the Python list and stores …

Python ValueError: invalid literal for int() with base 10: Solution

Python provides many inbuilt functions to convert a data type of one object to another, and one of …

Python TypeError: 'NoneType' object is not callable Solution

In Python to call a function, we use the function name followed by the parenthesis (). But if we tr…

Python TypeError: 'float' object cannot be interpreted as an integer …

In Python, we have two data types to represent numeric values float and int. Float data repres…

Python TypeError: 'method' object is not subscriptable Solution

A method is a function defined inside a Python class. Similar to  the function call, we use pa…

Search an element in rotated sorted array

You are given a sorted array and a key element as input. Find the index of the key element in the a…

Sort binary array in linear time

We have given a binary array (contains one 1s and 0s), and we need to write a logic that can sort t…