Kushal997-das / Hacktoberfest-2024

This repository aims to help code beginners with their first successful pull request and open source contribution. 🥳🎯🚀
https://kushal997-das.github.io/Hacktoberfest-2024/
MIT License
144 stars 292 forks source link

Ceil in the sorted array #373

Closed Aishwarya-S-Sharma closed 2 weeks ago

Aishwarya-S-Sharma commented 3 weeks ago

Ceil The Floor

Problem Given an unsorted array arr[] of integers and an integer x, find the floor and ceiling of x in arr[].

Floor of x is the largest element which is smaller than or equal to x. Floor of x doesn’t exist if x is smaller than smallest element of arr[]. Ceil of x is the smallest element which is greater than or equal to x. Ceil of x doesn’t exist if x is greater than greatest element of arr[].

Return an array of integers denoting the [floor, ceil]. Return -1 for floor or ceiling if the floor or ceiling is not present.

Examples:

Input: x = 7 , arr[] = [5, 6, 8, 9, 6, 5, 5, 6] Output: 6, 8 Explanation: Floor of 7 is 6 and ceil of 7 is 8.

Input: x = 10 , arr[] = [5, 6, 8, 8, 6, 5, 5, 6] Output: 8, -1 Explanation: Floor of 10 is 8 but ceil of 10 is not possible.

github-actions[bot] commented 3 weeks ago

@Aishwarya-S-Sharma

Welcome to the Project!

Thank you for opening this Issue 🙌! We’re thrilled to have you join us for Hacktoberfest 💖. We’ll review your submission and get back to you shortly.

In the meantime, please remember to give this repo a star! ⭐ We appreciate your contribution!

Aishwarya-S-Sharma commented 3 weeks ago

Hii @Kushal997-das Please assign this issue to me

NimraAslamkhan commented 3 weeks ago

Hi there! I am the Mentor of this project. Although this repo is not part of Hacktoberfest 2024, we have some great alternatives for you. Welcome to SkillShow, a repository focused on skill enhancement!

Guidelines:

Note: Start by creating an issue. Once it’s assigned to you, feel free to open a pull request (PR). Directly opening a PR will lead to an invalid label.

Looking forward to your contributions!