Articles on Trending Technologies

Technical articles with clear explanations and examples

How to Install and Use Command Line Cheat Sheets on Ubuntu

Sharon Christine
Sharon Christine
Updated on 25-Mar-2026 447 Views

Cheat is a Python-based command-line tool that allows system administrators to view and save helpful cheat sheets. It provides quick, text-based examples for commands you use frequently but not often enough to memorize. This tool is particularly useful for remembering command options, arguments, and common usage patterns. Installing Cheat on Ubuntu System Update Before installing Cheat, ensure your system is up to date ? $ sudo apt-get update && sudo apt-get upgrade Installing Python Pip Cheat is best installed using the Python package manager Pip. Install pip with the following command ? ...

Read More

Fish – A Smart and User-Friendly Interactive Shell for Linux

karthikeya Boyini
karthikeya Boyini
Updated on 25-Mar-2026 266 Views

The Fish (Friendly Interactive Shell) is an innovative command-line shell for Linux and Unix-like systems. Unlike traditional shells that disable features by default to save resources, Fish enables powerful features out of the box to enhance user productivity. Key Features of Fish Shell User-friendly and interactive interface Smart autosuggestions based on command history Web-based configuration interface Syntax highlighting with 256 terminal colors X clipboard integration Built-in error checking and validation Comprehensive help system Arrow key navigation for suggestions Installing Fish Shell Step 1: Install Python Software Properties First, install the required dependencies − ...

Read More

Find Numbers with Even Number of Digits in Python

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

Given a list of numbers, we need to count how many numbers have an even number of digits. For example, if the array is [12, 345, 2, 6, 7896], the output will be 2, since 12 (2 digits) and 7896 (4 digits) have even digit counts. Approach To solve this problem, we will follow these steps − Convert each integer to a string to easily count digits Check if the length of the string is even using modulo operation Increment counter for numbers with ...

Read More

Unique Number of Occurrences in Python

Akshitha Mote
Akshitha Mote
Updated on 25-Mar-2026 1K+ Views

Suppose we have an array, and we need to check whether each element has a unique number of occurrences. If no such element exists, we return false; otherwise, we return true. For example, given the array [1, 1, 2, 2, 2, 3, 4, 4, 4, 4], the function will return true because no two elements have the same number of occurrences: 1 occurs twice, 2 occurs three times, 3 occurs once, and 4 occurs four times. Using Dictionary to Track Occurrences A dictionary is ideal for counting occurrences since it stores key-value pairs where keys are unique elements ...

Read More

Prime Arrangements in Python

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

We need to find the number of permutations of numbers 1 to n where prime numbers are placed at prime indices (1-indexed). Since the result can be large, we return it modulo 10^9 + 7. For example, if n = 5, the output is 12. One valid permutation is [1, 2, 5, 4, 3], while [5, 2, 3, 4, 1] is invalid because 5 (prime) is at index 1 (not prime). Algorithm The key insight is that we need to arrange prime numbers in prime positions and non-prime numbers in non-prime positions separately ? Count ...

Read More

Day of the Year in Python

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

Sometimes we need to find which day of the year a specific date represents. For example, February 10th, 2019 is the 41st day of the year. Python provides several ways to calculate this using date manipulation. Algorithm Approach To calculate the day of the year manually, we follow these steps − Create an array of days in each month: [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] Parse the date string to extract year, month, and day Check if the year is a leap year and adjust February days to 29 ...

Read More

Number of Equivalent Domino Pairs in Python

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

When working with domino pairs, we need to find equivalent dominos where one can be flipped to match another. Two dominos D[i] = [a, b] and D[j] = [c, d] are equivalent if a = c and b = d, or a = d and b = c (since dominos can be reversed). We need to count all pairs (i, j) where 0 ≤ i < j < length of dominos list. For example, with dominos [[1, 2], [2, 1], [3, 4], [6, 5]], we have one equivalent pair: [1, 2] and [2, 1]. Algorithm To solve ...

Read More

Relative Sort Array in Python

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

Suppose we have two arrays arr1 and arr2, where elements of arr2 are unique, and all elements in arr2 are also present in arr1. We need to sort the elements of arr1 such that the relative ordering of items follows the sequence in arr2. Elements not present in arr2 should be placed at the end in ascending order. For example, if arr1 is [2, 3, 1, 3, 2, 4, 6, 7, 9, 2, 19] and arr2 is [2, 1, 4, 3, 9, 6], the result will be [2, 2, 2, 1, 4, 3, 3, 9, 6, 7, 19]. ...

Read More

Distribute Candies to People in Python

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

The candy distribution problem involves giving candies to people in increasing amounts across multiple rounds. In the first round, person 1 gets 1 candy, person 2 gets 2 candies, and so on. In subsequent rounds, the candy count continues incrementally from where it left off. Problem Understanding Given candies total candies and n people, we distribute candies in rounds ? Round 1: Give 1, 2, 3, ..., n candies Round 2: Give n+1, n+2, n+3, ..., 2n candies Continue until candies run out The last person gets remaining candies (if any) Algorithm Steps ...

Read More

Occurrences After Bigram in Python

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

When working with text analysis, you might need to find words that appear after a specific bigram (a sequence of two consecutive words). This problem involves finding all words that come immediately after a given pair of words in a text. For example, in the text "lina is a good girl she is a good singer", if we're looking for words that follow the bigram "a good", the result would be ["girl", "singer"]. Algorithm To solve this problem, we follow these steps: Split the text into individual words Create an empty result list Iterate through ...

Read More
Showing 1–10 of 61,304 articles
« Prev 1 2 3 4 5 6131 Next »
Advertisements