Nourish Care logo

Nourish Care Medium Interview Questions

5 medium-level practice questions for Nourish Care technical interviews

Nourish Care 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

No verified questions yet for Nourish Care.

coding Medium graph #1

1. [Graph] — Shortest Path in Nutritional Database

Background: Nourish Care needs an efficient way to retrieve nutritional information and related food items based on shortest path heuristics in a database. This is critical for ensuring that users find related meal options easily, especially in a healthcare context.
Problem statement: Given a graph represented as an adjacency list where nodes are food items, and weights are the distances metric (caloric difference), implement a function that returns the shortest path from a starting food item to a target food item.
You should implement the following function:
  • def shortest_path(nutritional_graph: Dict[str, List[Tuple[str, int]]], start: str, target: str) -> List[str]:

Example 1:
Input:
nutritional_graph = {'apple': [('banana', 1), ('grape', 3)], 'banana': [('grape', 2)], 'grape': []}
start = 'apple'
target = 'grape'
Output:
['apple', 'banana', 'grape']
Explanation: The shortest path is from 'apple' -> 'banana' -> 'grape'.
Example 2:
Input:
nutritional_graph = {'chicken': [('broccoli', 2), ('rice', 2)], 'broccoli': [('rice', 1)], 'rice': []}
start = 'chicken'
target = 'rice'
Output:
['chicken', 'rice']
Constraints:
  • 1 <= number of food items <= 1000

  • All weights are positive integers.

  • Each food item name is unique.
coding Medium binary search #2

2. Binary Search — Finding a user's nutritional data

Background: Nourish Care manages nutritional plans and records for users. Quickly searching through the nutritional data is essential for providing prompt support and personalized recommendations.
Problem statement: Given a sorted array of n integers representing user IDs and a target user ID, implement a function to search for the target user ID using the binary search algorithm. Return the index of the target if found, or -1 if not found.
Function/class signature:
  • def binary_search(users: List[int], target: int) -> int:


Example 1:
Input: users = [1, 3, 5, 7, 9], target = 5
Output: 2
Explanation: User ID 5 is located at index 2.
Example 2:
Input: users = [10, 20, 30, 40], target = 25
Output: -1
Explanation: User ID 25 does not exist in the list.
Constraints:
  • 1 <= n <= 10^5

  • Array is sorted in ascending order.

  • User IDs are unique.
coding Medium hash map #3

3. Hash Map — Count Unique Nutrients from Ingredients

Background: Nourish Care is focused on providing personalized nutrition solutions. To achieve this, they need to analyze various ingredients to determine their unique nutrient contributions.
Problem statement: Given a list of ingredients where each ingredient is a string, and each string may contain multiple nutrients separated by commas (e.g., "Protein, Fiber, Vitamin C"), your task is to return a list of unique nutrients. The order of nutrients in the output list should reflect their first occurrence in the input list.
Function/class signature:
  • def count_unique_nutrients(ingredients: List[str]) -> List[str]:

Example 1:
  • Input: ingredients = ["Protein, Fiber, Vitamin C", "Vitamin C, Protein", "Fiber"]

  • Output: ['Protein', 'Fiber', 'Vitamin C']

  • Explanation: The unique nutrients in the order they first appear are Protein, Fiber, and Vitamin C.

Example 2:
  • Input: ingredients = ["Iron, Calcium", "Calcium", "Iron"]

  • Output: ['Iron', 'Calcium']

  • Explanation: Iron and Calcium are unique, with Iron appearing first.

Constraints:
  • 1 <= len(ingredients) <= 1000

  • Each ingredient string has 1 to 100 characters.

  • Nutrients in each ingredient are separated by a comma, and there may be leading or trailing spaces.
coding Medium hash map #4

4. HASH MAP — Find Unique User IDs

Background: At Nourish Care, handling user data efficiently is crucial for providing personalized care services. User IDs must be unique to ensure accurate tracking of patient records across the platform.
Problem statement: You are given a list of user_ids representing users who have logged into the system. Some users may have logged in multiple times with different IDs due to system errors. Your task is to return a list of unique user IDs in the order they first appeared in the input list.
Function/class signature:
  • def find_unique_user_ids(user_ids: List[str]) -> List[str]:


Example 1:
  • Input: ['user1', 'user2', 'user3', 'user1', 'user2']

  • Output: ['user1', 'user2', 'user3']

  • Explanation: 'user1' and 'user2' are encountered again, but should appear only once in the result.


Example 2:
  • Input: ['userA', 'userB', 'userC', 'userA', 'userD']

  • Output: ['userA', 'userB', 'userC', 'userD']

  • Explanation: All IDs appear once except 'userA' which is limited to the first occurrence.


Constraints:
  • 1 <= user_ids.length <= 1000

  • user_ids[i] is a string of alphanumeric characters, length in range [1, 20]
coding Medium graph #5

5. [Graph] — Find the Optimal Nutritional Path

Background: Nourish Care aims to provide personalized nutritional plans for users, relying on their dietary preferences and nutritional needs. A critical challenge is optimizing meal recommendations based on user-defined criteria, which can be visualized as a graph of available meal options and their nutritional values.
Problem statement: Given a set of meals where each meal can be connected to others in the graph with varying nutritional scores, implement a function that determines the optimal nutritional path from a starting meal to the target meal, maximizing the total nutritional score. The function should return the maximum nutritional score achievable along the path.
Function/class signature:
  • def optimal_nutrition_path(meals: List[str], connections: List[Tuple[str, str, int]], start: str, target: str) -> int:


Example 1:
  • Input: meals = ['A', 'B', 'C', 'D'], connections = [('A', 'B', 5), ('A', 'C', 10), ('B', 'D', 4), ('C', 'D', 8)], start = 'A', target = 'D'

  • Output: 14

  • Explanation: The optimal path is A -> C -> D with a nutritional score of 10 + 8 = 18.


Example 2:
  • Input: meals = ['X', 'Y', 'Z'], connections = [('X', 'Y', 3), ('Y', 'Z', 2), ('X', 'Z', 10)], start = 'X', target = 'Z'

  • Output: 10

  • Explanation: The direct path X -> Z gives the maximum score of 10.


Constraints:
  • 1 <= len(meals) <= 100

  • 0 <= len(connections) <= 500

  • Nutritional scores will be positive integers.

Start practicing Nourish Care questions

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

Get Started Free