You are working in a ball factory where you have n balls numbered from lowLimit up to highLimit inclusive (i.e., n == highLimit - lowLimit + 1), and an infinite number of boxes numbered from 1 to infinity. Your job at this factory is to put each ball in the box with a number equal to the s
Given two integers n and k, you need to construct a list that contains n different positive integers ranging from 1 to n and obeys the following requirement:<br />Suppose this list is [a1, a2, a3, ... , an], then the list [|a1 - a2|, |a2 - a3|, |a3 - a4|, ... , |an-1 - an|] has exactly k distinct
Hercy wants to save money for his first car. He puts money in the Leetcode bank every day. He starts by putting in $1 on Monday, the first day. Every day from Tuesday to Sunday, he will put in $1 more than the day before. On every subsequent Monday, he will put in $1 more than the previous
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. Example 1: Input: date1 = "2019-06-29", date2 = "2019-06-30"<br />Output: 1<br />Example 2: Input: date
A web developer needs to know how to design a web page's size. So, given a specific rectangular web page’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
Given two non-negative integers low and high. Return the count of odd numbers between low and high (inclusive). 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
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: Input: num = 9669<br />Output: 9969<br />Explanation: <br />Changing the first dig
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
Given an integer number n, return the difference between the product of its digits and the sum of its digits.<br /> Example 1: Input: n = 234<br />Output: 15 <br />Explanation: <br />Product of digits = 2 * 3 * 4 = 24 <br />Sum of digits = 2 + 3 + 4 = 9 <br
Given a function 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) < f(x + 1, y)<br />f(x, y) < f(x, y + 1)<br />The function interface is defined like this: interface Cus
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,
Given a string date representing a Gregorian calendar date formatted as YYYY-MM-DD, return the day number of the year. 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