All Posts

Leetcode 1952: Three Divisors

Given an integer n, return true if n has exactly three distinct positive divisors. Otherwise, return false. A divisor of n is a positive integer that divides n without leaving a remainder.

Leetcode 1979: Find Greatest Common Divisor of Array

Given an array of integers, your task is to compute the greatest common divisor (GCD) of the smallest and largest elements in the array.

Leetcode 2001: Number of Pairs of Interchangeable Rectangles

You are given a list of rectangles, each represented by its width and height. Two rectangles are interchangeable if their width-to-height ratios are the same. Your task is to return the number of interchangeable rectangle pairs in the list.

Leetcode 2280: Minimum Lines to Represent a Line Chart

You are given a list of stock prices where each element represents the stock price on a specific day. The stock prices are given as pairs where the first element is the day number and the second element is the stock price for that day. A line chart can be drawn by plotting these prices on an XY-plane, where the X-axis represents the day and the Y-axis represents the price. Your task is to determine the minimum number of lines required to represent the stock prices as a continuous line chart.

Leetcode 2413: Smallest Even Multiple

Given a positive integer ’n’, return the smallest positive integer that is a multiple of both 2 and ’n'.

Leetcode 2427: Number of Common Factors

You are given two positive integers, a and b. Your task is to find the number of common divisors (factors) between a and b. A number x is considered a common divisor of a and b if it divides both a and b without leaving any remainder.