## Basic: Find All Duplicate Elements

Question: Please write a function to find all duplicate elements in a list. Input: a list of integers. Output: a set of integers that occur twice or more in the input list. Answer: We keep tracking the unique elements in a set. The next time we encounter any of those elements again, we put them … Read more

## Basic: Remove Vowels

Question: Given a string as an input, please create a function that would remove all vowels (‘a’, ‘i’, ‘u’, ‘e’, ‘o’) from that string. For simplicity, consider all characters in the input string are in lower case. Answer: ๐ Have fun while coding with Python! ๐ Please subscribe to receive notifications on future challenges. ๐ฌ If you … Read more

## Classic: Fibonacci Sequence

Question: Fibonacci sequence is a sequence of numbers where the number at position i is the sum of the numbers at positions i-1 and i-2. Please implement a function to output a Fibonacci sequence, as a list of length n with n as the input of the function. Assume that the first two elements of … Read more

## Basic: Prime Numbers

Question: Please implement a function to check whether a number is a prime number or not. A prime number is a number greater than one that can be divided (without leaving any reminder) only by one and the number itself. The function simply has one parameter (an integer) and a boolean input stating whether the … Read more

## Challenge: Target Sum

Question: Find two indexes from a list whose values are summed up to a predefined target number. Input: A list of integers and a target number. Output: another list containing two (or a pair of) indexes of the input list whose values summed up to the target number. If such pair does not exist, return … Read more

## Classic: Bubble Sort

Question Please implement Bubble Sort. Answer Bubble Sort is a basic and simple sorting algorithm. It has O(n^2) complexity. ๐ Have fun while coding with Python! ๐ Please subscribe to receive notifications on future challenges. ๐ฌ If you have any questions simply write a comment down below.

## Classic: Selection Sort

Question: Please implement Selection sort, which is a simple and basic sorting algorithm. It is not very fast. Its complexity is O(n^2). Answer: ๐ Have fun while coding with Python! ๐ Pleaseย subscribeย to receive notifications on future challenges. ๐ฌ If you have any questions simply write a comment down below.

## Challenge: Find Median in Linear Time

Question: A straightforward way to find a median from a list of numbers would be to first sort the list and then pick the middle element. Using this approach, the time complexity would be dominated by the sorting algorithm, which is O(n log n). Now, your task is to find a median in a linear … Read more

## Classic: Quicksort

Question: Please implement Quicksort Answer: This answer below performs a Quicksort without in-place element swaps. Thus, it requires bigger memory space but results in simpler and easier-to-understand code implementation. Below is a code for Quicksort with in-place swapping. The code is a bit more involved than without in-place swapping (above), but it requires less memory … Read more

## Challenge: Diamond

Question: Create a function to print a diamond with the pattern shown in the example below. The function has one input, n, an integer that controls the size of the diamond. Answer: The key here is to first separate the printing of the top and bottom half. Then, for each half, find the pattern of … Read more