Skip to main content

96 docs tagged with "Math"

View all tags

Add Digits

Given an integer num, repeatedly add all its digits until the result has only one digit, and return it.

Chalkboard XOR Game

Alice and Bob take turns erasing one number from the chalkboard. If removing a number makes the bitwise XOR of all remaining numbers become 0, the player who made that move loses. If at any player's turn, the XOR of all numbers on the chalkboard is already 0, that player wins. Alice starts first, and both play optimally to avoid losing.

Check if Point is Reachable

This document provides a solution where we need to reach the point (targetX, targetY) using a finite number of steps.

Count Primes

This is a solution to the Count Primes problem on LeetCode.

Domino and Tromino Tiling

Solve the problem of finding the number of ways to tile a 2 x n board using 2 x 1 dominos and tromino shapes.

Excel Sheet Column Title

Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet.

Fancy Sequence

This document provides a solution where we need to Write an API that generates fancy sequences using the append, addAll, and multAll operations.

Find the Closest Palindrome

This document provides a solution where we need to find the nearest palindrome to a given number n, the idea is to generate potential palindromic candidates close to n and then determine which one is closest in terms of absolute difference.

Fizz Buzz(LeetCode)

Given an integer n, return a string array answer (1-indexed) where "FizzBuzz" if i is divisible by 3 and 5, "Fizz" if i is divisible by 3, "Buzz" if i is divisible by 5, i (as a string) if none of the above conditions are true.

Magic Number

This tutorial covers the solution to the Magic Number problem from the GeeksforGeeks.

Mirror Reflection

Given a square room with mirrored walls and receptors at corners, a laser ray emitted from the southwest corner reflects off mirrors and reaches a receptor based on specified conditions.

Nth Fibonacci Number

This tutorial covers the solution to the Nth Fibonacci Number problem from the GeeksforGeeks.

Nth Fibonacci Number Problem (gfg)

This tutorial covers the solution to the Nth Fibonacci Number problem from the GeeksforGeeks website, featuring implementations in Python and C++.

Number of Digit One

This document provides a solution where we count the total number of digit $1$ appearing in all non-negative integers less than or equal to n.

Orderly Queue

Given a string s and an integer k, return the lexicographically smallest string that can be formed by repeatedly moving one of the first k characters of s to the end of the string.

Perfect Number

This document provides solutions for the Perfect Number problem.

Permutation Sequence(LeetCode)

The set [1, 2, 3, ..., n] contains a total of n! unique permutations. Given n and k, return the kth permutation sequence.

Power of Four

This is a solution to the Power of Four problem on LeetCode.

Reverse Integer(LeetCode)

Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-2^31, 2^31 - 1], then return 0.

Split Array With Same Average

This document provides a solution where we split an array into two non-empty subsets such that both subsets have the same average.

Stone Game III

This is a solution to the Stone Game III problem on LeetCode.

Ugly Number

This document provides a solution to the Ugly Number problem, where we need to determine if a number is an ugly number.

Ugly Number II

This document provides a solution to the Ugly Number II problem, where we need to find the nth ugly number.

Valid Square

This is a solution to the Valid Square problem on LeetCode.