https://github.com/jorjishasan/software_engineer-hackerrank
I solved three questions on three different topics ( SQL, REST API, Problem Solving). The problems were basic. I had fun solving them, and feel free to share them here. Put them in good use. Cheers 🥂
https://github.com/jorjishasan/software_engineer-hackerrank
problem-solving rest-api software-engineering sql
Last synced: 23 days ago
JSON representation
I solved three questions on three different topics ( SQL, REST API, Problem Solving). The problems were basic. I had fun solving them, and feel free to share them here. Put them in good use. Cheers 🥂
- Host: GitHub
- URL: https://github.com/jorjishasan/software_engineer-hackerrank
- Owner: jorjishasan
- Created: 2024-06-05T22:58:17.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-06-05T23:39:39.000Z (about 1 year ago)
- Last Synced: 2025-05-15T19:13:56.615Z (23 days ago)
- Topics: problem-solving, rest-api, software-engineering, sql
- Language: Python
- Homepage: https://www.hackerrank.com/certificates/bd5d8a43b7c2
- Size: 148 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ROLE: Software Engineer

Checkout the solutions at one go 🚀
## SQL: The Perfect Arrangement
```sql
SELECT ID, FIRST_NAME, LAST_NAME
FROM CUSTOMERS
WHERE LENGTH(CONCAT(FIRST_NAME, LAST_NAME)) < 12
ORDER BY LENGTH(CONCAT(FIRST_NAME, LAST_NAME)), CONCAT(FIRST_NAME, LAST_NAME), ID;
```## Problem Solving: Conference Schedule
```python
def maxPresentations(scheduleStart, scheduleEnd):
# Combine start and end times into tuples for easier sorting
presentations = [(start, end) for start, end in zip(scheduleStart, scheduleEnd)]presentations.sort(key=lambda x: x[1])
max_presentations = 0
current_end_time = 0
for start, end in presentations:
# If the current presentation starts after the previous one ends, attend it
if start >= current_end_time:
max_presentations += 1
current_end_time = end
return max_presentations```
## REST API: Patient's Medical Record
```python
import requestsdef getAverageTemperatureForUser(userId):
base_url = "https://jsonmock.hackerrank.com/api/medical_records"page = 1
total_temps = 0
total_records = 0while True:
response = requests.get(f"{base_url}?userId={userId}&page={page}").json()
data = response["data"]if not data:
breakfor record in data:
body_temperature = record.get("vitals", {}).get("bodyTemperature", 0)
total_temps += body_temperature
total_records += 1if page >= response["total_pages"]:
breakpage += 1
if total_records == 0:
return "0"average_temp = round(total_temps / total_records, 1)
return str(average_temp)
```