The circumference of a circle can be defined as the outer boundary of the circle. It is the perimeter of a circle. Each point around a circle follows certain properties as follows − Point (x, y) lying inside the circle such that, $\mathrm{x^2 + y^2 < R^2}$ Point (x, y) lying on the circle such that, $\mathrm{x^2 + y^2 = R^2}$ Point (x, y) lying outside the circle such that, $\mathrm{x^2 + y^2 > R^2}$ where R = radius of the circle. Problem Statement Given a string S representing a sequence of moves (L, R, U, D) and ... Read More
Django, a powerful and popular Python web framework, has revolutionized the way developers create dynamic web applications. With its robust features and ease of use, Django has become a go−to choice for building scalable and secure websites. On the other hand, Firebase, a cloud−based platform provided by Google, offers a comprehensive suite of tools for app development, including real−time databases, authentication, and hosting. In this tutorial, we will explore how to create a new project in Django using Firebase as the database. We'll dive into the step−by−step process of setting up the development environment, configuring Django to work with ... Read More
Python is a dynamic and skilled programming language that supports object−oriented programming (OOP). At the heart of OOP is the concept of objects, which are instances of a class. Classes in Python serve as blueprints for creating objects with specific attributes and methods. One common use case in OOP is to create a list of objects, where each object represents a unique instance of the class. In this article, we will talk about the process of creating a list of objects within a Python class. We will discuss the essential steps involved, including defining a class, creating objects of that ... Read More
In recent years, the web platform has evolved significantly, enabling developers to create more powerful and interactive applications. With the introduction of HTML5 and JavaScript, developers now have the tools to build not just websites but also games that can run directly in the browser. In this article, we will explore the process of building a Progressive Web Game using JavaScript and HTML5 Canvas, with a practical example of a "Brick Breaker" game. What are Progressive Web Games? Progressive Web Games are web-based games that leverage modern web technologies to provide a rich and immersive gaming experience. They are ... Read More
Python is a great programming language widely used for various data manipulation tasks. When working with files and folders, it can be useful to generate a list of all the files, folders, and subfolders within a directory. Excel, on the other hand, is a popular spreadsheet application that allows users to organize and analyze data. In this detailed article, we will explore step−by−step how to use Python to create a comprehensive list of files, folders, and subfolders in Excel, providing a convenient way to manage and analyze file structures. So make sure to stick with this till the end. Prerequisites ... Read More
In computer programming, comments are text written with the source code but ignored by the compiler or interpreter. They are used to provide readability of code by describing the code and its functionality for someone who is reading the code other than a compiler or interpreter. They are not executed and do not affect the functionality of the overall program, they are just for programmer guidance. Each programming language has a different syntax to represent comments. Here are a few examples − C/C++ − In C or C++, single-lined comments begin with ‘//’ and multi-liner comments are enclosed in ... Read More
An overlapping area is an area that is shared by two objects. In the case of rectangles, it is the area of the rectangles that belong to both rectangles. In order to find the total areas of two overlapping rectangles, first er need to add the area of both rectangles respectively but in this total, the overlapping area is counted twice. Thus we need to subtract the overlapping area too. Problem Statement Given the bottom left and top right vertices of two rectangles. Find the total area covered by the two rectangles. Sample Example 1 Input bl_x1 = 0 bl_y1 ... Read More
The pairwise product of a set X = {a, b, c} can be defined as the sum of the product of all possible set pairs. The pairs of the set are, Y = {a * a, a * b, a *c, b * b, b * c, c * c}, where the product is commutative. Thus, the pairwise product of set X is the summation of elements of set Y i.e. aa + ab + ac + bb + bc + cc. In mathematical terms, the sum of possible pair products can be depicted as, $$\mathrm{\displaystyle\sum\limits_{i=1, j=i}^{i\leq n, j\leq n}\:(i, ... Read More
Heap Sort − Heap sort is a comparison-based algorithm that used binary tree data structures to sort a list of numbers in increasing or decreasing order. It heap sorts to create a heap data structure where the root is the smallest element and then removes the root and again sorting gives the second smallest number in the list at the root position. Min Heap − Min heap is a data structure where the parent node is always smaller than the child node, thus root node is the smallest element among all. Problem Statement Given an array of integers. Sort them ... Read More
Golomb Sequence − The Golomb Sequence is a non-decreasing sequence of integers where the value of the nth term is the number of times the integer n appeared in the sequence. Some terms of Golomb sequence are, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, … Here as we can see, the 5th term is 3 and 5 also appears 3 times in the sequence. The 6th term is 4 and 6 also appears 4 times in ... Read More