Top K Frequent Words Solution Amazon OA 2023

Top K Frequent Words Amazon Online Assessment

Top K Frequent Words Solution Given a non-empty list of words, return the k most frequent elements. Your answer should be sorted by frequency from highest to lowest. If two words have the same frequency, then the word with the lower alphabetical order comes first. Example 1: Input: [“i”, “love”, “leetcode”, “i”, “love”, “coding”], k … Read more

Reorder Data in Log Files Solution Amazon OA 2023

Reorder Data in Log Files Amazon Online Assessment

Reorder Data in Log Files Solution You are given an array of logs. Each log is a space-delimited string of words, where the first word is the identifier. There are two types of logs: Reorder these logs so that: Return the final order of the logs. Example 1: Input: logs = [“dig1 8 1 5 … Read more

Shopping Patterns Solution Amazon OA 2023

Shopping Patterns Amazon Online Assessment

Shopping Patterns Minimum Degree of a Connected Trio in a Graph You are given an undirected graph. You are given an integer n which is the number of nodes in the graph and an array edges, where each edges[i] = [ui, vi] indicates that there is an undirected edge between ui and vi. A connected … Read more

Trees Height Solution Amazon OA SDE 2023

Trees Height Solution Amazon OA SDE

Trees Height Solution Amazon OA 2023 SDE There are N trees in Jon’s backyard and height of tree i is h[i]. Jon doesn’t like the appearance of it and is planning to increase and decrease the height of trees such that the new heights are in strictly increasing order. Every day he can pick one … Read more

Shopping Options Amazon OA 2023 Solution

Shopping Options Amazon OA

Shopping Options Amazon OA 2023 Solution Alternative Question: Find All Combination of Numbers Sum to Target Given a positive integer, target, print all possible combinations of positive integers that sum up to the target number. For example, if we are given input ‘5’, these are the possible sum combinations. The output will be in the … Read more