Question: Convert an array of email folder objects to an array of Gmail label strings.
// Sample input:
folders = [
{id: 27, parentId: 15, name: 'projects'},
{id: 81, parentId: 27, name: 'novel'},
{id: 15, parentId: 0, name: 'personal'}, // a parentId of 0 means root
{id: 35, parentId: 27, name: 'blog'},
]
// Sample output:
labels = [
'personal/projects',
'personal/projects/novel',
'personal',
'personal/projects/blog',
// Sample input:
folders = [
{id: 27, parentId: 15, name: 'projects'},
{id: 81, parentId: 27, name: 'novel'},
{id: 15, parentId: 0, name: 'personal'}, // a parentId of 0 means root
{id: 35, parentId: 27, name: 'blog'},
]
// Sample output:
labels = [
'personal/projects',
'personal/projects/novel',
'personal',
'personal/projects/blog',
]
Google Online Assessment Questions:
- Min Amplitude
- Ways to Split String
- Maximum Time ⭐⭐⭐
- Min Abs Difference of Server Loads ⭐
- Most Booked Hotel Room ⭐⭐⭐
- Minimum Domino Rotations For Equal Row
- Time to Type a String
- Maximum Level Sum of a Binary Tree
- Min Number of Chairs
- K Closest Points to Origin
- Odd-Even Jump
- License Key Formatting
- Unique Email Addresses
- Fruit Into Baskets
- Min Days to Bloom
- Fill Matrix
- Decreasing Subsequences
- Max Distance
- Stores and Houses
Microsoft Online Assessment Questions:
- Min Deletions to Make Frequency of Each Letter Unique
- Min Swaps to Make Palindrome
- Min Steps to Make Piles Equal Height
- Largest K such that both K and -K exists in the array
- Max Length of a Concatenated String with Unique Characters
- Unique Integers That Sum Up To 0
- Partition array into N subsets with balanced sum
- Jump Game [Experienced]
- Meeting Rooms II
- Count Visible Nodes in Binary Tree
- Largest Alphabetic Character
Question:
There are n people who are willing to explore a haunted house. However, each person is willing to go in only if there are at least L and almost H other people(excluding him) are willing to go inside along with him. Given n and L, H for each of these people, find the maximum number of people who can visit in a single group.
Example Input:
n = 6
L H of each one below
1 2 (which means person 1 is willing to go if there is at least 1 other person willing to go with him and almost 2 others - Excluding himself)
1 4
0 3
0 1
3 4
0
There are n people who are willing to explore a haunted house. However, each person is willing to go in only if there are at least L and almost H other people(excluding him) are willing to go inside along with him. Given n and L, H for each of these people, find the maximum number of people who can visit in a single group.
Example Input:
n = 6
L H of each one below
1 2 (which means person 1 is willing to go if there is at least 1 other person willing to go with him and almost 2 others - Excluding himself)
1 4
0 3
0 1
3 4
0
Answer: 3 -> In a single visit 1,2,3 can group and visit. Another answer: 1,2,6. No more than 3 people can visit together in a single visit, given the requirements.
Question:
Given an integer N, return the smallest non-negative number whose individual digits sum up to N.
Question:
Question:
There are N blocks from 0 to N-1. A couple of frogs were sitting together on one block, They had a quarrel and need to jump away from one another. The frogs can only jump to another block if the height of the other block is greater than equal to the current one. You need to find the longest possible distance that they can possibly create between each other if they also choose to sit on an optimal starting block initially.
Question:
A pizza shop offers n pizzas along with m toppings. A customer plans to spend around x coins. The customer should order exactly one pizza and may order zero, one, or two toppings. Each topping may be ordered only once.
Given the lists of prices of available pizzas and toppings, what is the price closest to x of possible orders? Here, a price said closer to x when the difference from x is smaller. Note the customer is allowed to make an order that costs more than x.
Example 1:
Input: pizzas = [800, 850, 900], toppings = [100, 150], x = 1000
Output: 1000
Explanation:
The customer can spend exactly 1000 coins (two possible orders).
Given the lists of prices of available pizzas and toppings, what is the price closest to x of possible orders? Here, a price said closer to x when the difference from x is smaller. Note the customer is allowed to make an order that costs more than x.
Example 1:
Input: pizzas = [800, 850, 900], toppings = [100, 150], x = 1000
Output: 1000
Explanation:
The customer can spend exactly 1000 coins (two possible orders).
Example 2:
Input: pizzas = [850, 900], toppings = [200, 250], x = 1000
Output: 1050
Explanation:
The customer may make order more expensive than 1000 coins.
Example 3:
Input: pizzas = [1100, 900], toppings = [200], x = 1000
Output: 900
Explanation:
The customer should prefer 900 (lower) over 1100 (higher).
Example 4:
Input: pizzas = [800, 800, 800, 800], toppings = [100], x = 1000
Output: 900
Explanation:
The customer may not order 2 same toppings to make it 1000.
Constraints:
Customer's budget: 1 <= x <= 10000
Number of pizzas: 1 <= n <= 10
Number of toppings: 0 <= m <= 10
Price of each pizza: 1 <= pizzas[i] <= 10000
Price of each topping: 1 <= toppings[i] <= 10000
The total price of all toppings does not exceed 10000.
*******Thanks For Visiting*********
0 Comments