Alice was always good at math. Her only weak points were multiplication and subtraction. To help her with that, Bob presented her with the following problem. He gave her four positive integers. Alice can change their order optionally. Her task is to find an order, denoted by A1,A2,A3 and A4, with the maximum value of A1×A2 − A3×A4. Input The input…
All as we know, a mountain is a large landform that stretches above the surrounding land in a limited area. If we as the tourists take a picture of a distant mountain and print it out, the image on the surface of paper will be in the shape of a particular polygon. From mathematics angle we can describe the range of the mountain in the picture as a list of…
题目描述: LeetCode第一题,两数之和 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target…
题目描述: Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if either (a==c and b==d), or (a==d and b==c) - that is, one domino can be rotated to be equal to another domino. Return the number of pairs (i, j) for which 0 <= i < j < dominoes.length, and dominoes[i] is equivalent to dominoes[j]. Example…