Given an array A of integers, we must modify the array in the following way: we choose an i and replace A with -A, and we repeat this process …
Let’s say, if we want to expand strings that contain dynamic variables, we can use regular expression to do this easily. const varContent = { VAR: "World", } console.log(expand("Hello, …
Given a year Y and a month M, return how many days there are in that month. Example 1: Input: Y = 1992, M = 7 Output: 31 Example …
A Leap year occurs mostly every 4 years, but every 100 years, we skip a leap year, unless it is divisible by 400. Leap Year Algorithm if (year is …
The k-digit number N is an Armstrong number if and only if the k-th power of each digit sums to N. Given a positive integer N, return true if …
Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = , nums2 = Output: Example 2: Input: nums1 = , nums2 = Output: Note: …