Skip to content

Practice Patients With a Condition

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1527
LeetCode Problem

Patients With a Condition

Problem Statement

Tables: Patients(patient_id INT, patient_name VARCHAR, conditions VARCHAR). Patients.patient_id is unique. conditions contains zero or more diagnosis codes separated by spaces. Return patient_id, patient_name and conditions when at least one diagnosis code starts with DIAB1. Match at the start of a code, not in the middle of an unrelated code. Output order is unrestricted.

Source: Patients With a Condition on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
Patients table: +------------+--------------+--------------+ | patient_id | patient_name | conditions   | +------------+--------------+--------------+ | 1          | Daniel       | YFEV COUGH   | | 2          | Alice        |              | | 3          | Bob          | DIAB100 MYOP | | 4          | George       | ACNE DIAB100 | | 5          | Alain        | DIAB201      | +------------+--------------+--------------+
Output
+------------+--------------+--------------+ | patient_id | patient_name | conditions   | +------------+--------------+--------------+ | 3          | Bob          | DIAB100 MYOP | | 4          | George       | ACNE DIAB100 | +------------+--------------+--------------+

Related LeetCode Problems

Practice more problems similar to Patients With a Condition.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.