Question You are building a simplified card game where each player has a hand of cards and the higher-rated hand wins. Each hand contains exactly...
Input: String Output: Computed result
codingMediumVerified Question#2
2. [AI Enabled Coding] Food Delivery Company
Category: String coding problem
Question You are building a driver payment system for a food delivery company. The accounting team needs to track how much money is owed to drivers...
Input: String Output: Integer
technicalMediumVerified Question#3
3. How to pass AI Enabled Coding Rounds From FAANG Interviewer
Category: Algorithm coding problem
Tips For AI Coding Rounds AI coding rounds are not as different from regular coding rounds as you might think. The interviewer still needs to get...
Input: Given input Output: Computed result
codingMediumgraph#1
1. Graph — Find the Shortest Path with Weight Constraints
Background: Rippling manages various payroll and human resource data for companies. A crucial feature is optimizing transportation costs associated with employee relocations. To solve this, we need a way to find the most efficient route based on weight constraints of packages. Problem statement: You are given a directed graph where each edge has a weight representing the cost of transportation. Your task is to write a function that finds the shortest path from a given startNode to an endNode such that the total weight does not exceed a given weightLimit. If no such path exists, return None. Function/class signature:
Explanation: No path from A to C exists under the weight limit of 6.
Constraints:
The graph contains at most 10^5 nodes.
Each edge has a weight from 1 to 100.
Weight limit will be a positive integer up to 500.
All nodes are unique strings without spaces.
codingMediumdynamic programming#2
2. Dynamic Programming — Minimum Cost to Hire Employees
Background: At Rippling, companies streamline their employee management processes, and finding the optimal way to hire employees while minimizing costs is crucial. This problem relates to the payroll management system involving salaries and hiring strategies. Problem statement: You are given an array cost of size n where cost[i] represents the cost of hiring the i-th employee. You can hire employees in blocks (consecutive hires). Since hiring costs may vary, you want to determine the minimum total cost to hire all the employees. Implement a function min_cost(cost: List[int]) -> int that returns this minimum cost. Function/class signature:
def min_cost(cost: List[int]) -> int:
Example 1:
Input: cost = [10, 20, 30]
Output: 60
Explanation: The total cost to hire all employees directly is 10 + 20 + 30 = 60.
Example 2:
Input: cost = [10, 30, 20, 40]
Output: 100
Explanation: Hiring in blocks optimally leads to minimum cost, which is sequential hire in this case.
Constraints:
1 <= cost.length <= 1000
1 <= cost[i] <= 1000
The total cost should account for different strategies in hiring based on competition and salary expectations.
codingMediumhash map#3
3. Coding Challenge — Implement an employee attendance system
Background: At Rippling, efficient employee management is crucial, especially in handling attendance for various purposes like payroll and compliance. An efficient solution can automate this process, ensuring that all records are accurate and accessible.Problem statement: You are required to implement a class AttendanceSystem that tracks employee attendance. The class should support methods to mark attendance, check if an employee was present on a given day, and get the total attendance count for an employee. Each employee is identified by a unique employee ID.Function/class signature:
Explanation: Employee with ID 1 marked present on October 1st, 2023.
Example 2:
Input: was_present(1, "2023-10-01")
Output: True
Explanation: Employee 1 was present on October 1st, 2023.
Constraints:
employee_id is a positive integer.
date is formatted as "YYYY-MM-DD" and represents valid dates only.
The number of attendance records will not exceed 10^5.
codingMediumhash map#4
4. Coding Challenge — Find the Longest Consecutive Sequence
Background: As Rippling enhances its payroll processing system, it needs to analyze employee engagement data more effectively. Tracking consecutive active days of employees is essential for assessing participation in company initiatives. Problem statement: Given an unsorted array of integers representing employee IDs, write a function that returns the length of the longest consecutive sequence of IDs. The sequence is defined as consecutive integers that differ by 1. Function/class signature:
def longest_consecutive(nums: List[int]) -> int:
Example 1:
Input:[100, 4, 200, 1, 3, 2]
Output:4
Explanation: The longest consecutive sequence is [1, 2, 3, 4], which has a length of 4.
Example 2:
Input:[1, 2, 0, 1]
Output:3
Explanation: The longest consecutive sequence is [0, 1, 2], with a length of 3.
Constraints:
0 <= len(nums) <= 10^5
-10^9 <= nums[i] <= 10^9
system designMediumapi design#5
5. Graph — Implement a hotel booking system
Background: Rippling needs a robust hotel booking system to manage inventory and bookings efficiently across various properties. This system should provide the ability to handle varying room types, availability, and guest reservations effectively.Problem statement: Create a class HotelBookingSystem that allows users to manage bookings in a hotel. The class should support the following operations: adding hotel rooms, checking availability for a specific date range, and making a reservation if rooms are available. Ensure that the book_room method prevents double bookings and updates the room availability accordingly.Function/class signature: