Aditya Chatterjee's Blog, page 69
October 9, 2022
Super Pow Problem [LeetCode: 372]
Example:a = 9 & b = [6,7,3,4]9^6734 -> The result will be too large.we are asked to give the result as (9^6734)37 which is equal to 1075.Table of ContentsProblem ExplanationModulo OperatorBruteForce Approach / Code / Time & Space ComplexityOptimise Approach / Code / Time & Space ComplexityProblem Explanation:Your task is to calculate a^b mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form of an array.
In this pro...
Linux Package Management
The word Linux will refer to any operating system that uses the Linux kernel
Package management entails installing, upgrading, configuring, and removing software. Besides the tasks above, package management tools also facilitate software dependency resolution.
A dependecy is an additional package required by a principal package to function properly.
There are roughly three Linux distribution families:
DebianRedHatSlackwareEach distribution family above has its own package management system....
Python script to retweet recent tweets with a particular hashtag
Many of us are avid users of Twitter. I for one, am on Twitter almost 24/7, whether it is for developer news, networking with coders, or general entertainment!
However, one thing I have always wanted to do is to get a list of tweets with a trending or other particular hashtag (for example, #elonmusk or #python).
In fact, we can actually automate this process with code using the tweepy library!
In this article, we will learn how to write a Python script to scrape recent tweets wtih a particular ...
Cache Stampede
Introduction to CachingWhat is cache?
There's a OpenGenus logo at the top-left corner of this page and this page also has the favicon of OpenGenus. If you open another article in OpenGenus, the same logo and favicon will still be there, meaning it is common for any page on OpenGenus.
In normal cases, your browser will need to re-download the logo every single time you visit a different page on this site,...
October 6, 2022
Different approaches to calculate Euler's Number (e)
In this article, we have explored different approaches to calculate Euler's Number (e) along with sample implementations to calculate Euler's number to different precision.
TABLE OF CONTENT -INTRODUCTION ABOUT EULER NUMBERAPPLICATIONS OF EULER NUMBER (e)CALCULATING METHODSMETHOD 1: HORIZONTAL ASYMPTOTEMETHOD 2: FACTORIALSINTRODUCTION -Euler's number e is among one of the most famous mathematical constants after pi. It has permanent place on our calcultors lets explore about it.
Eulers ...
Advanced C++ topics
In this article, we will discuss different advanced C topics with a brief description along with C code examples.
The C language is an object-oriented programming language. It was developed by Dennis Ritchie at the BELL Laboratory AT & T.C was initially known as "C with classes" and in 1983 it was renamed as 'C'. Still now it has version as C 98 ,C 03,C 11,C 14,C 17,C 20. In every version of C ,new topic and feature were added.
Here is a list of different Advanced C topics we...
Exception Handling in C#
Simply put, exception handling is used as a preventative measure to handle an error that might otherwise crash the entire program. An example could look like this: the program tries to open a file that doesn't exist. Without exception handling, this very likely would cause a crash. Using exception handling, we could instead create the file it is trying to open, give an error message to the user, log the error, or however else you wish to handle the exception. Another ...
October 5, 2022
React Components
Introduction to React
React is a free and open-source front-end JavaScript library for building user interfaces based on UI components. React is not a framework, but a js library. React is created and maintained by Facebook.
Why React?React has a component based architecture. This lets the developer to break down the applicati...
aligned_alloc()
Reading time: 5 minutes | Coding time: 5 minutes
Need for aligned memory space Usage Return Values Implementationaligned_alloc() like malloc() and calloc() is used for dynamic allocation of memory how it differs from the rest is how it enables the user to dynamically allocate the memory as well as allows us to specify the alignment for the newly allocated memory.
Need for aligned memory space.SpeedThe CPU reads at it's word size (4 bytes on 32 bit processor, 8 bytes on 64 b...
Open-Closed principle
The open-closed principle is one the first five principles of software design, by Robert C. Martin.
The five principles where stated as follows:
They are also referred to as the SOLID design principles. These principles are necessary for the production of clear, clean, easily maintainable and extensible code.
In this article, we will to...