All Posts

Leetcode 258: Add Digits

Given a non-negative integer num, repeatedly add all of its digits until the result has only one digit, and return it.

Leetcode 858: Mirror Reflection

In a special square room with mirrors on all four walls, except for the southwest corner, there are receptors at three other corners, numbered 0, 1, and 2. A laser ray is fired from the southwest corner and hits the east wall at a certain distance from the 0th receptor. Given the side length of the square room, p, and the distance q from the 0th receptor on the east wall where the laser ray meets, return the number of the receptor the ray hits first after bouncing around the room.

Leetcode 866: Prime Palindrome

Given an integer n, find the smallest integer that is both a prime number and a palindrome, and is greater than or equal to n. A prime number is an integer greater than 1 with no divisors other than 1 and itself. A palindrome is a number that reads the same forwards and backwards.

Leetcode 1201: Ugly Number III

An ugly number is a positive integer that is divisible by at least one of the integers a, b, or c. Your task is to return the nth ugly number in the sequence formed by the integers divisible by a, b, or c.

Leetcode 1447: Simplified Fractions

Given an integer n, return a list of all unique simplified fractions between 0 and 1 (exclusive) where the denominator is less than or equal to n. A fraction is simplified if the greatest common divisor (GCD) of the numerator and denominator is 1. The result can be returned in any order.

Leetcode 1492: The kth Factor of n

You are given two positive integers n and k. A factor of an integer n is defined as an integer i where n % i == 0. Consider a sorted list of all factors of n in ascending order. Return the kth factor from this list or return -1 if n has less than k factors.