Skip to content
the poor coder

Home / Topics / #math

#Math

9 posts
2021

Leetcode - Maximum 69 Number Solution

Given a positive integer num consisting only of digits 6 and 9. Return the maximum number you can get by changing at most one digit (6 becomes 9, and 9 becomes 6). Example 1: Example 2: Example 3: Constraints: 1 <= num…

leetcodeMath1 min read
2021

Leetcode - Self Dividing Numbers Solution

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 % 2 == 0, and 128 % 8 == 0. Also, a self-dividing number is not…

leetcodeMath1 min read
2021

Leetcode - Power of Three Solution

Given an integer n, return true if it is a power of three. Otherwise, return false. An integer n is a power of three, if there exists an integer x such that n == 3x. Example 1: Example 2: Example 3: Example 4…

leetcodeMath1 min read
2021

Leetcode - Happy Number Solution

Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits. Repeat…

2021

Leetcode - Sqrt(x) Solution

Given a non-negative integer x, compute and return the square root of x. Since the return type is an integer, the decimal digits are truncated, and only the integer part of the result is returned. Example 1: Example 2…

2021

Leetcode - Multiply Strings Solution

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. Note: You must not use any built-in BigInteger library or convert the inputs to…

2020

Hackerrank Polar Coordinates Solution

Polar coordinates are an alternative way of representing Cartesian coordinates or Complex Numbers. A complex number is completely determined by its real part and imaginary part . Here, is the imaginary unit. A polar…

ESC