Preparing for an interview? Check out Cracking the Coding Interview
Published on

Amazon Hackon | Online Assessment | Round I | Cleared | 28th May 2024

Author
  • Shared Anonymously

Recently, I had the exciting opportunity to participate in the Amazon Hackon Online Assessment (Round I), and I'd love to share my experience with you all!

Hackon is an annual hackathon organized by Amazon, where groups of 2-4 members come together to tackle various challenges. The first round, a proctored coding round, featured two intriguing coding problems that had to be solved within 90 minutes. The atmosphere was intense, but the experience was incredibly rewarding!

First Question:

I personally felt this question was one of those "either you get it immediately or you never will." . It was based on Basic mathematics and could be solved in constant time and space, i.e., O(1) for both.

Problem Statement:
Alice plays a fun game in which she picks a natural number \uD835\uDC41. She then puts all the natural numbers less than or equal to \uD835\uDC41 into a set. Next, she has to split this set into two subsets where neither subset is empty. She is also given two integers, \uD835\uDC34 and \uD835\uDC35.
Determine if it is possible for Alice to divide the set into two subsets such that the ratio of the sum of numbers in subset 1 to the sum of numbers in subset 2 is \uD835\uDC34 : \uD835\uDC35. If it is possible, print the sums of the elements in subset 1 and subset 2; if not, print -1.

Testcases Passed : 8 / 10.

Second Question:

This question didn't seem particularly challenging to me; I was able to solve it successfully in about 15 minutes with all testcases passed.
It was based particularly on Greedy and Binary search and could be solved in O(n logm) time with constant space.

Problem Statement:
You are given an array T of size N, where T[i] signifies the position of house i on the x-axis. Consider each house to be point-sized. Additionally, you are given an array S of size M, where S[i] signifies the position of streetlight i on the same x-axis. Note that a house and a streetlight can be placed at the same x-coordinate.
Return the integer k, which is the maximum distance between any streetlight i and any house j such that streetlight i illuminates house j. Note that any streetlight can illuminate a house at an infinite distance away.

Some participants might find the question difficult to understand, and that's understandable given the organizer's unclear statement. However, once you grasp the core requirement, it can be approached systematically.

Testcases Passed: 10 / 10.

Note: No constraints were provided for both of these problems : (

ReportMark as Helpful