Blogs Hub

by AskGif | Oct 18, 2020 | Category :coding

Number of Days Between Two Dates - Maths - Easy - LeetCode

Number of Days Between Two Dates - Maths - Easy - LeetCode

Write a program to count the number of days between two dates. The two dates are given as strings, their format is YYYY-MM-DD as shown in the examples. &nbsp; Example 1: Input: date1 = "2019-06-29", date2 = "2019-06-30"<br />Output: 1<br />Example 2: Input: date

read more...

by AskGif | Oct 17, 2020 | Category :coding

Construct the Rectangle - Maths - Easy - LeetCode

Construct the Rectangle - Maths - Easy - LeetCode

A web developer needs to know how to design a web page's size. So, given a specific rectangular web page&rsquo;s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements: The area of the rectangular web page you designed must

read more...

by AskGif | Oct 02, 2020 | Category :coding

Count Odd Numbers in an Interval Range - Math - Easy - LeetCode

Count Odd Numbers in an Interval Range - Math - Easy - LeetCode

Given two non-negative integers low and high. Return the count of odd numbers between low and high (inclusive). &nbsp; Example 1: Input: low = 3, high = 7<br />Output: 3<br />Explanation: The odd numbers between 3 and 7 are [3,5,7].<br />Example 2: Input: low = 8, high

read more...

by AskGif | Oct 02, 2020 | Category :coding

Maximum 69 Number - Math - Easy - LeetCode

Maximum 69 Number - Math - Easy - LeetCode

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). &nbsp; Example 1: Input: num = 9669<br />Output: 9969<br />Explanation:&nbsp;<br />Changing the first dig

read more...

by AskGif | Oct 02, 2020 | Category :coding

Convert Integer to the Sum of Two No-Zero Integers - Math - Easy - LeetCode

Convert Integer to the Sum of Two No-Zero Integers - Math - Easy - LeetCode

Given an integer n. No-Zero integer is a positive integer which doesn't contain any 0 in its decimal representation. Return a list of two integers [A, B] where: A and B are No-Zero integers.<br />A + B = n<br />It's guarateed that there is at least one valid solution. If there are m

read more...

by AskGif | Oct 02, 2020 | Category :coding

Subtract the Product and Sum of Digits of an Integer - Math - Easy - LeetCode

Subtract the Product and Sum of Digits of an Integer - Math - Easy - LeetCode

Given an integer number n, return the difference between the product of its digits and the sum of its digits.<br />&nbsp; Example 1: Input: n = 234<br />Output: 15&nbsp;<br />Explanation:&nbsp;<br />Product of digits = 2 * 3 * 4 = 24&nbsp;<br />Sum of digits = 2 + 3 + 4 = 9&nbsp;<br

read more...

by AskGif | Oct 02, 2020 | Category :coding

Find Positive Integer Solution for a Given Equation - Math - Easy - LeetCode

Find Positive Integer Solution for a Given Equation - Math - Easy - LeetCode

Given a function &nbsp;f(x, y) and a value z, return all positive integer pairs x and y where f(x,y) == z. The function is constantly increasing, i.e.: f(x, y) &lt; f(x + 1, y)<br />f(x, y) &lt; f(x, y + 1)<br />The function interface is defined like this:&nbsp; interface Cus

read more...

by AskGif | Oct 02, 2020 | Category :coding

Prime Arrangements - Math - Easy - LeetCode

Prime Arrangements - Math - Easy - LeetCode

Return the number of permutations of 1 to n so that prime numbers are at prime indices (1-indexed.) (Recall that an integer is prime if and only if it is greater than 1, and cannot be written as a product of two positive integers both smaller than it.) Since the answer may be large,

read more...

by AskGif | Oct 01, 2020 | Category :coding

Day of the Year - Math - Easy - LeetCode

Day of the Year - Math - Easy - LeetCode

Given a string date representing a Gregorian calendar date formatted as YYYY-MM-DD, return the day number of the year. &nbsp; Example 1: Input: date = "2019-01-09"<br />Output: 9<br />Explanation: Given date is the 9th day of the year in 2019.<br />Example 2: Input: da

read more...

by AskGif | Oct 01, 2020 | Category :coding

Distribute Candies to People - Math - Easy - LeetCode

Distribute Candies to People - Math - Easy - LeetCode

We distribute some number of candies, to a row of n = num_people people in the following way: We then give 1 candy to the first person, 2 candies to the second person, and so on until we give n candies to the last person. Then, we go back to the start of the row, giving n + 1 candie

read more...

by AskGif | Oct 01, 2020 | Category :coding

Valid Boomerang - Math - Easy - LeetCode

Valid Boomerang - Math - Easy - LeetCode

A boomerang is a set of 3 points that are all distinct and not in a straight line. Given a list of three points in the plane, return whether these points are a boomerang. &nbsp; Example 1: Input: [[1,1],[2,3],[3,2]]<br />Output: true<br />Example 2: Input: [[1,1

read more...

by AskGif | Oct 01, 2020 | Category :coding

Divisor Game - Math - Easy - LeetCode

Divisor Game - Math - Easy - LeetCode

Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a number N on the chalkboard. &nbsp;On each player's turn, that player makes a move consisting of: Choosing any x with 0 &lt; x &lt; N and N % x == 0.<br />Replacing the number N on the chalkboar

read more...