Table of contents Recursive exponential Recursive max Recursive multiplication Recursive sum Recursive average Recursive uppercase Recursive exponential Given two exponential numbers with the same base, the multiplication is another exponential number with the same base but we add the exponents. We can utilize this observation and define a recursive exponential formula. If (n) is even

Table of contents Circular linked list Linked list nth node from the end Reverse linked list Reverse linked list recursively Circular linked list This is a typical interview question. Given a singly linked list. Write a function that detects if the linked list is circular (has a loop) which means the last node points to

Problem In this Python code snippet, we are going to implement a naive run length encoding algorithm to compress strings Solution The idea is very simple, text has redundancy so instead of sending plain text, we can compress text by sending characters and their counts. This is a typical text processing problem that gets asked

Problem Write a Python function that checks if two strings are rotation of each other Solution Rotating a string means inserting a number of characters from the end of the string to the beginning of the string. Any easy trick to check if two strings are rotation of each other is to concatenate one string

Problem Implement an algorithm in Python to check if a given input string is a permutation of another palindrome string Solution If the number of occurrences of all characters in the string is even then the input string can be a permutation of a palindrome string. There is only once exception which is the character

Problem Write an algorithm in Python to check if two strings are permutations of each other Solution Let us differentiate between permutations and combinations. An easy way is to think about permutations in terms of lists and combinations in terms of sets. Take a look at the code snippets below… Code Thanks for visiting. Please

Problem Given a string of characters. Implement an algorithm in Python to check if the string has all unique characters. Solution One solution is to get the unique characters in the string using a set. If the length of the input string is the same as the length of the set then the string has

String palindrome in python Write python code to find palindrome strings. A Palendrome string can be read the same from either direction left to right or right to left. Palindrome python code Here is a palindrome algorithm python code. You may also checking this post for a C++ implementation. Thanks for visiting. Please use the

Anagram solver in python Two strings are anagrams if they contain the same set of characters regardless of the order of individual characters such as “earth” and “heart”. Write python code to detect if two strings are anagrams. Python anagram solver code Here is the code in python. You may also check this solution in

Python repeated character in string Given a string of characters. Write python code to print the repeated characters Solution This is a typical dictionary based problem. Here is how to do that in Python. You may need to take a look at the following similar articles Character count in string java String repeated characters count