SmithRx logo

SmithRx Interview Questions

7 practice questions for SmithRx technical interviews

SmithRx software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
coding Medium Verified Question #1

1. Frog Distance


Category: Array coding problem
You are given an array blocks of N integers representing the heights of blocks arranged in a row, numbered from 0 to N - 1. Two frogs start...
Input: Array
Output: Computed result
coding Medium api design #1

1. Cloud Infrastructure — Understanding AWS VPC Components

Background: As SmithRx leverages cloud services for scalability and efficiency, a solid understanding of AWS infrastructure is paramount. This problem focuses on the configuration and management of Virtual Private Clouds (VPCs) within an application that handles sensitive healthcare data.
Problem statement: You are tasked with designing an AWS VPC for a healthcare application that requires a public subnet for web servers and a private subnet for databases. Your design must also include traffic rules to allow secure communication. Implement a function create_vpc_config that takes the necessary parameters and returns a configuration dictionary representing the VPC setup.
Function/class signature:
  • def create_vpc_config(vpc_name: str, cidr_block: str, public_subnet: str, private_subnet: str, security_group: List[str]) -> Dict[str, Any]:

Example 1:
Input:
create_vpc_config(
"HealthcareVPC",
"10.0.0.0/16",
"10.0.1.0/24",
"10.0.2.0/24",
["allow_http", "allow_db"])
Output:
{ "VpcName": "HealthcareVPC", "CIDRBlock": "10.0.0.0/16", "PublicSubnet": "10.0.1.0/24", "PrivateSubnet": "10.0.2.0/24", "SecurityGroupRules": ["allow_http", "allow_db"] }
Explanation: This output indicates that a VPC called 'HealthcareVPC' is created with specified subnets and security group rules.
Example 2:
Input:
create_vpc_config(
"PatientPortalVPC",
"192.168.0.0/16",
"192.168.1.0/24",
"192.168.2.0/24",
["allow_https", "allow_ssh"])
Output:
{ "VpcName": "PatientPortalVPC", "CIDRBlock": "192.168.0.0/16", "PublicSubnet": "192.168.1.0/24", "PrivateSubnet": "192.168.2.0/24", "SecurityGroupRules": ["allow_https", "allow_ssh"] }
Constraints:
  • vpc_name is a string of up to 100 characters.

  • cidr_block follows the CIDR notation rules.

  • public_subnet and private_subnet must be within the range of cidr_block.

  • security_group is a list of strings with a maximum length of 10 items.
coding Medium hash map #2

2. [Hash Map] — Find the most frequently prescribed medication

Background: In the pharmaceutical context of SmithRx, understanding the most frequently prescribed medications can help improve inventory management and patient service. This problem simulates a feature where the company can analyze prescriptions effectively.
Problem statement: Given a list of medications prescribed, write a function to determine the most frequently prescribed medication. If there are ties, return any of the most frequent medications.
Function/class signature:
  • def most_frequent_medication(medications: List[str]) -> str:

Example 1:
Input: ['DrugA', 'DrugB', 'DrugA', 'DrugC', 'DrugB', 'DrugA']
Output: 'DrugA'
Explanation: DrugA appears 3 times, more than any other medication.
Example 2:
Input: ['DrugX', 'DrugY', 'DrugZ', 'DrugY', 'DrugZ', 'DrugZ']
Output: 'DrugZ'
Explanation: DrugZ appears 3 times, which is more than DrugY and DrugX.
Constraints:
  • 1 <= len(medications) <= 10000

  • medications[i] is a string representing the name of a medication.


coding Medium tree #3

3. [Tree] — Find the Lowest Common Ancestor of two nodes

Background: In the context of SmithRx, managing relationships between medication prescriptions and patients is critical. By effectively identifying parent-child relationships in hierarchical data, we can improve data retrieval processes and optimize prescription management systems.
Problem statement: Given a binary tree where each node represents a patient or medication, write a function to find the Lowest Common Ancestor (LCA) of two given nodes (patients or medications). The LCA is defined as the deepest node that is an ancestor of both nodes. The function should handle the edge cases like when either node is not present in the tree.
Function/class signature:
  • def lowest_common_ancestor(root: Optional[TreeNode], p: TreeNode, q: TreeNode) -> Optional[TreeNode]:


Example 1:
Input: root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1
Output: 3
Explanation: The LCA of nodes 5 and 1 is 3.
Example 2:
Input: root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 4
Output: 5
Explanation: The LCA of nodes 5 and 4 is 5 itself, as one of the nodes is in the path.
Constraints:
  • The number of nodes in the tree is in the range [2, 10^5].

  • Each node has unique values.

  • All TreeNode values are in the range [0, 10^9].
coding Medium networking #4

4. AWS VPC Components — Determine the subnet allocation

Background: SmithRx leverages AWS cloud infrastructure to host its services, and efficient network design is key for optimal security and performance. Understanding VPC components is essential for maintaining the architecture of SmithRx's cloud environment.
Problem statement: You are tasked to calculate the number of subnets that can be created from a given CIDR (Classless Inter-Domain Routing) block for use in AWS VPC. Given a CIDR block, you must return how many subnets can be created if each subnet must have at least 256 IP addresses. Assume standard subnetting rules apply. Here, a subnet with x available IP addresses means a CIDR block of x size in practice.
Function/class signature:
  • def calculate_subnets(cidr: str) -> int:

Example 1:
  • Input: "10.0.0.0/16"

  • Output: 256

  • Explanation: The CIDR block 10.0.0.0/16 provides 2^(32-16) = 65536 IP addresses, which can be divided into 256 subnets of 256 IPs each.

Example 2:
  • Input: "192.168.1.0/24"

  • Output: 1

  • Explanation: The CIDR block 192.168.1.0/24 provides 256 IP addresses which can only form 1 subnet.

Constraints:
  • The CIDR block will always be valid.

  • The provided block will be a private address range.

  • The CIDR size will not exceed /16.
coding Medium hash map #5

5. AWS VPC Components — Implement a function to analyze VPC configurations

Background: SmithRx uses AWS infrastructure to manage cloud resources efficiently. Understanding the components of AWS VPC is crucial for maintaining secure and scalable applications.
Problem statement: You are tasked with analyzing a list of AWS VPC components. Each component is represented by a dictionary with the following keys: type (a string representing the type of component, e.g., 'subnet', 'route table'), id (a unique identifier), and status (a string representing the operational status, e.g., 'active', 'inactive'). Write a function that takes in this list of components and returns a summary of each component type showing the total count and the list of active IDs for that type.
Function/class signature:
  • def analyze_vpc(components: List[Dict[str, Union[str, bool]]]) -> Dict[str, Dict[str, Union[int, List[str]]]]:


Example 1:
  • Input: [{'type': 'subnet', 'id': 'subnet-1', 'status': 'active'}, {'type': 'subnet', 'id': 'subnet-2', 'status': 'inactive'}, {'type': 'route table', 'id': 'rtb-1', 'status': 'active'}]

  • Output: {'subnet': {'count': 1, 'active_ids': ['subnet-1']}, 'route table': {'count': 1, 'active_ids': ['rtb-1']}}

  • Explanation: There is 1 active subnet and 1 active route table.


Example 2:
  • Input: [{'type': 'subnet', 'id': 'subnet-1', 'status': 'inactive'}, {'type': 'route table', 'id': 'rtb-1', 'status': 'inactive'}]

  • Output: {'subnet': {'count': 0, 'active_ids': []}, 'route table': {'count': 0, 'active_ids': []}}

  • Explanation: No active components are present in this input.


Constraints:
  • The number of components can be at most 10^4.

  • Each id is unique and contains alphanumeric characters.

  • status` will only be 'active' or 'inactive'.
system design Medium database #6

6. [Database] — Implement a system to track prescription records for patients

Background: SmithRx needs a reliable way to manage and store patient prescription records to ensure accurate medication dispensation. This system helps keep track of which medications each patient has been prescribed, along with relevant details like dosage and refill dates.
Problem statement: You are to implement a class named PrescriptionTracker that will manage patient prescriptions. Each patient can have multiple prescriptions, and each prescription contains details including the medicationName, dosage, refillDate, and a patientId. The class should support adding new prescriptions and retrieving a list of prescriptions for a given patient ID.
Function/class signature:
  • def add_prescription(self, patient_id: str, medication_name: str, dosage: str, refill_date: str) -> None:

  • def get_prescriptions(self, patient_id: str) -> List[Dict[str, str]]:

Example 1:
Input:
tracker = PrescriptionTracker()
tracker.add_prescription('PATIENT123', 'Amoxicillin', '500mg', '2023-12-01')
output = tracker.get_prescriptions('PATIENT123')
Output:
[{'medicationName': 'Amoxicillin', 'dosage': '500mg', 'refillDate': '2023-12-01'}]
Explanation: After adding a prescription for the patient, the retrieval shows the correct details.
Example 2:
Input:
tracker.add_prescription('PATIENT123', 'Ibuprofen', '200mg', '2024-01-10')
output = tracker.get_prescriptions('PATIENT123')
Output:
[{'medicationName': 'Amoxicillin', 'dosage': '500mg', 'refillDate': '2023-12-01'}, {'medicationName': 'Ibuprofen', 'dosage': '200mg', 'refillDate': '2024-01-10'}]
Explanation: The retrieval now includes both prescriptions for the same patient.
Constraints:
  • The patient_id, medication_name, and dosage are strings with a maximum length of 100 characters.

  • The refill_date is a string in YYYY-MM-DD format.

  • The number of prescriptions for a single patient cannot exceed 1000.

Start practicing SmithRx questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free