Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 615 Bytes

File metadata and controls

28 lines (23 loc) · 615 Bytes

Ceil and Floor

Easy


  1. You are given a number n, representing the size of array arr.
  2. You are given n numbers (in ascending order), representing elements of the array arr.
  3. You are given another number k.
  4. You are required to print the ceil and floor of k in array arr.

Example 1:

Input:  n= 5, arr[] = {7, 14, 18, 25, 30}, k= 18
Output:  18 18

Example 2:

Input:  n= 8, arr[] = {5, 10, 15, 22, 33, 40, 42, 55}, k= 25
Output:  33 22

Constraints:

1 <= n <= 1000
-10^9 <= n1, n2, .. n elements <= 10^9
-10^9 <= d <= 10^9