## 5-Star Review Percentage - Google Top Interview Questions

You are given a two-dimensional list of integers reviews and a positive integer threshold. Each element reviews[i] contains [x, y] meaning product i had x number of 5-star reviews and a total of y reviews. All reviews are for one store. Return the minimum number of additional 5-star reviews we need such that the percentage of 5-star reviews in the store is at least threshold. You can assume that it's possible to reach threshold% of 5-star reviews. Constraints 1 ≤ n ≤ 100,000 where n is

## Closest Distance to Character - Google Top Interview Questions

Given a string s and a character c, return a new list of integers of the same length as s where for each index i its value is set the closest distance of s[i] to c. You can assume c exists in s. Constraints n ≤ 100,000 where n is the length of s Example 1 Input s = "aabaab" c = "b" Output [2, 1, 0, 1, 1, 0]

## Coincidence Search - Google Top Interview Questions

You are given a list of unique integers nums. Return the number of integers that could still be successfully found using a standard binary search. Binary search in pseudocode: lo = 0 hi = nums.size - 1 while lo <= hi mid = floor((lo + hi) / 2) if nums[mid] == target return mid elif nums[mid] < target lo = mid + 1 else hi = mid - 1 Constraints 0 ≤ n ≤ 100,000 where n is the length of nums. Example 1 Input nums = [1, 5, 3, 2,

## Inverted Subtree - Google Top Interview Questions

A tree is defined to be an inversion of another tree if either: Both trees are null Its left and right children are optionally swapped and its left and right subtrees are inversions. Given binary trees source and target, return whether there's some inversion T of source such that it's a subtree of target. That is, whether there's a node in target that is identically same in values and structure as T including all of its descendants. Constraints n ≤ 12 where n is the number of nodes in

## K Numbers Greater Than or Equal to K - Google Top Interview Questions

You are given a list of non-negative integers nums. If there are exactly k numbers in nums that are greater than or equal to k, return k. Otherwise, return -1. Constraints 1 ≤ n ≤ 100,000 where n is the length of nums Example 1 Input nums = [5, 3, 0, 9] Output 3 Explanation There are exactly 3 numbers that's greater than or equal to 3: [5, 3, 9].