## Minimum Absolute Difference Queries Leetcode Solution

Minimum Absolute Difference Queries The minimum absolute difference of an array a is defined as the minimum value of |a[i] – a[j]|, where 0 <= i < j < a.length and a[i] != a[j]. If all elements of a are the same, the minimum absolute difference is -1. For example, the minimum absolute difference of the array [5,2,3,7,2] is |2 – 3| = 1. Note that it is not 0 because a[i] and a[j] must be different. You … Read more

## Count Sub Islands LeetCode Solution

Count Sub Islands You are given two m x n binary matrices grid1 and grid2 containing only 0‘s (representing water) and 1‘s (representing land). An island is a group of 1‘s connected 4-directionally (horizontal or vertical). Any cells outside of the grid are considered water cells. An island in grid2 is considered a sub-island if there is an island in grid1 that contains all the cells that make up this island in grid2. Return the number of islands in grid2 that are considered sub-islands. … Read more

## The Number of Full Rounds You Have Played Leetcode Solution

The Number of Full Rounds You Have Played A new online video game has been released, and in this video game, there are 15-minute rounds scheduled every quarter-hour period. This means that at HH:00, HH:15, HH:30 and HH:45, a new round starts, where HH represents an integer number from 00 to 23. A 24-hour clock is used, so the earliest time in the day is 00:00 and the latest is 23:59. Given two strings startTime and finishTime in … Read more

## Largest Odd Number in String Leetcode Solution

Largest Odd Number in String You are given a string num, representing a large integer. Return the largest-valued odd integer (as a string) that is a non-empty substring of num, or an empty string “” if no odd integer exists. A substring is a contiguous sequence of characters within a string. Example 1: Input: num = “52” Output: “5” Explanation: The only non-empty substrings are “5”, … Read more

## Amazon OA 2020 Amazon Music Pairs SOLUTIONS

Amazon Music Pairs Amazon Music is working on a new “community radio station” feature which will allow users to iteratively populate the playlist with their desired songs. Considering this radio station will also have other scheduled shows to be aired, and to make sure the community soundtrack will not run over other scheduled shows, the … Read more

## Beautiful Arrangement Solution LeetCode

Beautiful Arrangement January Leetcoding Challenge Beautiful Arrangement Solution LeetCode Answer Suppose you have n integers labeled 1 through n. A permutation of those n integers perm (1-indexed) is considered a beautiful arrangement if for every i (1 <= i <= n), either of the following is true: perm[i] is divisible by i.i is divisible by … Read more

## Find a Corresponding Node of a Binary Tree in a Clone of That Tree Solution Leetcode

Find a Corresponding Node of a Binary Tree in a Clone of That Tree January Leetcoding Challenge Find a Corresponding Node of a Binary Tree in a Clone of That Tree solution leetcode answer Given two binary trees original and cloned and given a reference to a node target in the original tree. The cloned … Read more

## Check Array Formation Through Concatenation Solution LeetCode

Check Array Formation Through Concatenation January Leetcoding Challenge Check Array Formation Through Concatenation Solution Leetcode Answer You are given an array of distinct integers arr and an array of integer arrays pieces, where the integers in pieces are distinct. Your goal is to form arr by concatenating the arrays in pieces in any order. However, … Read more

## Add to Array-Form of Integer Solution LeetCode

Solution Add to Array-Form of Integer LeetCode For a non-negative integer X, the array-form of X is an array of its digits in left to right order.  For example, if X = 1231, then the array form is [1,2,3,1]. Given the array-form A of a non-negative integer X, return the array-form of the integer X+K. Example 1: Input: A = [1,2,0,0], K = 34 Output: [1,2,3,4] … Read more

## 1-bit and 2-bit Characters Solution LeetCode

Solution 1-bit and 2-bit Characters We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). Now given a string represented by several bits. Return whether the last character must be a one-bit character or not. The given string will always end … Read more

error: Content is protected !!
+