Company: Amazon_17feb
Difficulty: medium
Sort Bug Report Frequencies Problem Description You are helping Amazon's Quality Assurance engineers process bug reports generated from automated testing logs across various devices and services. Each log contains an integer bug code, and a single test session may include duplicate bug codes if the same issue is triggered multiple times. To effectively prioritise debugging and resolution, the following rules are applied: Less frequent bugs are considered more important, as they may indicate rare or edge-case issues. If two bugs occur the same number of times, the bug with the lower code number has higher priority. The task is to sort the bug codes in order of decreasing importance, using the above rules. This means bugs with lower frequency come first. If frequencies are equal, bugs with lower code numbers come first. Example Given bugs = [8, 4, 6, 5, 4, 8] . First, determine the frequency of each bug code: Item Code Frequency 8 2 4 2 6 1 5 1 According to the rules: Bugs with frequency