Online round: There are total 4 questions to solve and the round was held on HackerRank platform.
- Fun with Anagrams: Two strings are anagrams if they are permutations of each other. For example, “aaagmnrs” is an anagram of “anagrams”. Given an array of strings, remove each string that is an anagram of an earlier string, then return the remaining array in sorted order.Example: The given the strings s = [‘code’, ‘doce’, ‘ecod’, ‘framer’, ‘frame’], the strings ‘doce’ and ‘ecod’ are both anagrams of ‘code’ so they are removed from the list. The words ‘frame’ and ‘framer’ are not anagrams due to the extra ‘r’ in ‘framer’, so they remain. The final list of strings in
alphabetical order is [‘code’, ‘frame’, ‘framer’].
- Maximizing Profit from Stocks: Your algorithms have become so good at predicting the market that you now know what the share price of Silly Purple Toothpicks Inc. (SPT) will
be for a number of minutes going forward. Each minute, your high-frequency trading platform allows you to either buy one share of SPT, sell any number of shares of SPT that you own, or not make any transaction at all. Find the maximum profit you can obtain with an optimal trading strategy. Purchases are negative and sales are positive cash flows in the following equations.Example: If predicted prices over the next n = 6 minutes are prices = [3, 4, 5, 3, 5, 2], one way to the best outcome is to purchase a share in each of the first 2 minutes for cash flows -3 + -4 = -7, then sell them at the third minute for 2 * 5 = 10. Purchase a share in the 4th minute for 3 and sell it in the 5th minute for 5. Total profits are -3 – 4 + 10 – 3 + 5 = 5. Another way to the same outcome is to purchase a share in each of the 1st, 2nd and 4th minutes for -3 – 4 – 3 = -10, do nothing at minute 2 then sell all three shares at 5 (total 3 * 5 = 15) on the 5th day, again for a total profit of -10 + 15 = 5. There is no reason to purchase in the last minute as there is no time to sell.
- Parking Dilemma: There are many cars parked in the parking lot. The parking is a straight, very long line and has a parking slot for every single meter. There are n cars parked currently and you want to cover them from the rain by building a roof. The requirement is that at least k cars are covered by the roof. What’s the minimum length of the roof that would cover k cars?Example: There are 4 cars parked at slots 2, 10, 8 and 17 respectively and k = 3. Then, you can build a roof of length 9 covering all parking slots from the 2nd one to the 10th one, so covering 3 cars at slots 2, 10 and 8. There is no shorter roof that can cover 3 cars,
so the answer is 9.
- Primes in Subtree: Construct a rooted undirected graph and then answer some queries on the graph. There are n nodes numbered from 1 to n. All the nodes are disconnected initially. Construct the graph by drawing an undirected edge between m pairs of nodes, picking one pair at a time and connecting the first and second nodes. After connecting each of the pairs, the graph construction is complete, and node 1 is the root node of this graph. A node’s parent is the next node on the shortest path from that node to node 1, and a descendant is on the shortest path to a leaf moving away from node 1. At this point, the graph can be considered a tree rooted at node 1, and subtrees can be formed rooted at any node and consisting of its descendants.Each node has a positive integer value associated with it. Find the total number of nodes with values as prime numbers in a given subtree rooted at a given node. Note that 1 is not a prime number. There are multiple queries.
Onsite round 1:
- Find Next Sparse Number:
Onsite round 2:
- Find the smallest positive integer value that cannot be represented as sum of any subset of a given array: https://www.geeksforgeeks.org/find-smallest-value-represented-sum-subset-given-array/
- Design Elevator system:
- APT Portfolio Interview Experience | Set 1 (On-Campus)
- TIAA Interview Experience -Java Back Backend Developer (3+ years Experience)
- Microsoft Interview Experience (Full Time 2018 Washington DC - with 2.5 years of experience)
- Goldman Sachs Interview Experience | Set 23 (2+ years Experience for Java Developer Role)
- Samsung R&D Bangalore Interview Experience | Lateral hire (6 month experience)
- Arcesium Interview Experience - Senior Software Engineer (3 years experience)
- Oyo Rooms Interview Experience | Set 3 (For Backend Engineer, Experience <=1yrs)
- Brocade Interview Experience | Set 2 (For Software Engineer 0-2.5 Years Experience)
- Arcesium Interview Experience Software Engineer (1+ year experience)
- Nutanix Interview Experience for MTS - QA (4+ year experience) [ Language - Python ]
- Nagarro Interview Experience for Xamarin Developer | 3 Years Experience
- Arcesium Interview Experience | Set 5 (3+ years experience - Developer profile)
- Mentor Graphics (Siemens) Interview Experience (For Experience – 3 yrs) | Sr. MTS
- Amazon Interview Experience | Set 167 (SDE I for 1 year 6 months experience)
- Walmart Lab Interview Experience | Set 8 (Off-Campus 3 Years Experience)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.