“Who likes it” code Challenge in Python
The Challenge You probably know the “like” system from Facebook and other pages. People can “like” blog posts, pictures or other items. We want to… Read More »“Who likes it” code Challenge in Python
The Challenge You probably know the “like” system from Facebook and other pages. People can “like” blog posts, pictures or other items. We want to… Read More »“Who likes it” code Challenge in Python
It took the Python community a long time to move from Python 2 to Python 3. Now as we approach the possible end of Python… Read More »Python 4 New Features Planned
The challenge The rgb function is incomplete. Complete it so that passing in RGB decimal values will result in a hexadecimal representation being returned. Valid… Read More »Custom RGB To Hex Conversion with Python
The challenge We want to create a function that will add numbers together when called in succession. We also want to be able to continue… Read More »How to write a Chain Adding Function in Python
The challenge Create a function that takes a positive integer and returns the next bigger number that can be formed by rearranging its digits. For… Read More »Get the next biggest number with the same digits using Python
The challenge As the name may already reveal, it works basically like a Fibonacci, but summing the last 3 (instead of 2) numbers of the… Read More »Solving Tribonacci Sequence with Python
The challenge You are given three piles of casino chips: white, green and black chips: the first pile contains only white chips the second pile… Read More »The Casino Chips Problem Solved with Python
The challenge An isogram is a word that has no repeating letters, consecutive or non-consecutive. Implement a function that determines whether a string that contains… Read More »Check if Isogram using Python
The challenge Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an… Read More »Find the Longest Common Prefix using Python
The challenge he count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 2. 11 3. 21 4. 1211… Read More »Count and Say with Python
The challenge Given a non-empty array of digits representing a non-negative integer, increment one to the integer. The digits are stored such that the most significant digit is at… Read More »The Plus One problem solved with Python
The challenge Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could… Read More »Solving the Single Number problem in Python
The challenge You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate the image in-place, which… Read More »Rotate a Matrix List in Python
The challenge Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2,2] Example 2:… Read More »Find the Intersection of Two Arrays in Python
The challenge Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: nums = [1,2,3,4,5,6,7], k = 3 Output: [5,6,7,1,2,3,4]… Read More »Rotate an Array K Times in Python
Python has a fantastic feature called slices. It allows you to work with a list, set or string by it’s index items. E.g.: You can… Read More »Python Splices reimplemented in Java
The challenge Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each… Read More »Solving Two Sum in Python
The challenge Write a function: def solution(A) that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does… Read More »Get the Next Small Integer in Python
The challenge Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all… Read More »Find All Numbers Disappeared in an Array using Python
Introduction Java has a built-in called HashMap. It allows you to store and very quickly retrieve key value pairs. In Python, this is called a… Read More »HashMaps (aka: Dictionaries) in Python
The challenge In an N by N square grid, each cell is either empty (0) or blocked (1). A clear path from top-left to bottom-right has length k if and… Read More »Get The Shortest Path in Binary Matrix using Python
The problem Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Example: Input: “aab” Output: [… Read More »Palindrome Partitioning in Python
The problem Say you have an array prices for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum… Read More »Best Time to Buy and Sell Stock with Python
Introduction A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because 128 % 1 == 0, 128… Read More »Self Dividing Numbers using Python
Today I got a really dumb error from Python. RuntimeError: thread.__init__() not called But luckily it’s really easy to fix! Below is the code before… Read More »RuntimeError: thread.__init__() not called (Python)