Euclidean Distance Limitation
One of the Euclidean distance limitations I will try to explain. Let’s consider 3 data points v1, v2, and v3. These points are shown in the attached picture. When Euclidean distance is calculated between vectors v1, v2, and v2, v3, the distances are the same. In this case, we don’t know which vectors are nearby. So, in this case, we can use cosine similarity. Cosine similarity calculations are shown in the picture. As per calculation, we can say that the cosine of v1 and v2 is close to 1, so the angle (v1&v2) is smaller compared to the angle between v2 and v3. We can say v1 and v2 vectors are nearby.
Distribution of Numbers
A distribution of numbers is approximately bell shaped. If the mean of the numbers is 125 and the standard deviation is 12, between what two numbers would approximately 68% of the values fall? Between what two numbers would 95% of the values fall? Between what two values would 99.7% of the values fall?
LeetCode-Hard-4. Median of Two Sorted Arrays
Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: Input: nums1 = [1,3], nums2 =  Output: 2.00000 Explanation: merged array = [1,2,3] and median is 2. …
LeetCode 2413. Smallest Even Multiple
Given a positive integer n, return the smallest positive integer that is a multiple of both 2 and n. Example 1: Input: n = 5 Output: 10 Explanation: The smallest multiple of both 5 and 2 is 10. Example 2: Input: n = 6 Output: 6 Explanation: The smallest multiple of both 6 and 2 is 6. Note that a number is a multiple of itself. Constraints: 1 <= n <= 150 Solutions class Solution: def smallestEvenMultiple(self, n: int) -> int:
LeetCode 1512. Number of Good Pairs
Given an array of integers nums, return the number of good pairs. A pair (i, j) is called good if nums[i] == nums[j] and i < j. Example 1: Input: nums = [1,2,3,1,1,3] Output: 4 Explanation: There are 4 good pairs (0,3), (0,4), (3,4), (2,5) 0-indexed. Example 2: Input: nums = [1,1,1,1] Output: 6 Explanation: Each pair in the array are good. Example 3: Input: nums = [1,2,3] Output: 0 Constraints: 1 <= nums.length <= 100
Leet Code 2469. Convert the Temperature
You are given a non-negative floating point number rounded to two decimal places celsius, that denotes the temperature in Celsius. You should convert Celsius into Kelvin and Fahrenheit and return it as an array ans = [kelvin, fahrenheit]. Return the array ans. Answers within 10-5 of the actual answer will be accepted. Note that: Kelvin = Celsius + 273.15 Fahrenheit = Celsius * 1.80 + 32.00 Example 1:
LeetCode-SQL-1757. Recyclable and Low Fat Products
Table: Products +-------------+---------+ | Column Name | Type | +-------------+---------+ | product_id | int | | low_fats | enum | | recyclable | enum | +-------------+---------+ product_id is the primary key for this table. low_fats is an ENUM of type…